Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Download the data file Class10Data1.mat from eCampus. Write a function in which you: a) plot the data using a scatter plot of y vs. x

image text in transcribedDownload the data file Class10Data1.mat from eCampus. Write a function in which you: a) plot the data using a scatter plot of y vs. x to check that a linear model makes sense, b) use polyfit to fit a linear model to the data and output the slope and intercept, and c) plot the best-fit line on the same graph as the scatter plot. I'm having trouble with making the function file and loading that .mat file into matlab and using the data from the mat file to make the scatter plot. This is what I have image text in transcribed

Your output should look like this :image text in transcribed

: +16 | ICA 11. m | ICA 10. m :| Class10Data 1.mat X|Class10Data2.mat X1+ 2 1 function importfile(fileToRead1) 2 %IMPORTFILE ( FILETOREADI) 3 % Imports data from the specified file 4 % FILETOREA01: file to read 6 % Auto-generated by MATLAB on 21-Feb-2018 15:30:54 8 % Import the file 9 newDatal=load('-mat", fileToRead1 ) ; 10 11 % create new variables in the base workspace from those fields. 12 vars=fieldnames(newDatal); 13 for i= 1:length(vars) 14 15 end 16 2 ssignin('base, varsfi, newDatal. (vars(i)); 0 : +16 | ICA 11. m | ICA 10. m :| Class10Data 1.mat X|Class10Data2.mat X1+ 2 1 function importfile(fileToRead1) 2 %IMPORTFILE ( FILETOREADI) 3 % Imports data from the specified file 4 % FILETOREA01: file to read 6 % Auto-generated by MATLAB on 21-Feb-2018 15:30:54 8 % Import the file 9 newDatal=load('-mat", fileToRead1 ) ; 10 11 % create new variables in the base workspace from those fields. 12 vars=fieldnames(newDatal); 13 for i= 1:length(vars) 14 15 end 16 2 ssignin('base, varsfi, newDatal. (vars(i)); 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions