Question: 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
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 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 
Your output should look like this :
: +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
Get step-by-step solutions from verified subject matter experts
