Below is a Matlab script which produces the plot shown. Add lines to the script
ID: 3917290 • Letter: B
Question
Below is a Matlab script which produces the plot shown. Add lines to the script to produce a best fit curve. The curve should be drawn on the same figure and should be drawn as a solid line. Be sure to add titles on the x and y axes and a title for the figure. You are not permitted to change any lines in the existing script: you may only add new lines. (15 points) 4. 10) 10 10 fid fopen ('prob4data.txt') fgetl (fid) : table-fscan f (tid, 'inf', [2 inf])"; fclose(fid); 10 10° 10 10 x-table ( : , 1 ) ; y table(i,2) loglog (x,YExplanation / Answer
Answer:
P = polyfit(x,y,1);
yfit = P(1)*x+P(2); // line =n i-e, slope and intercept
hold on;
plot(x,yfit,'r-'); // r stands for red color and - is for solid line
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.