Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(in MATLAB) The scenario is simple: a set of (x,y) data is available in the form

ID: 3708236 • Letter: #

Question

(in MATLAB)

The scenario is simple: a set of (x,y) data is available in the form of a simple text file the first column represents x-values and the second column represents y-values. The task is to provide the best model (or curve fit) to this set of data. Your application should provide the means to fit the following curve types to the data TextFile.txt 1.298 1.566 1.766 1.976 2.115 2.330 2.475 2.641 2.874 3.065 0.103005 0.133416 0.190314 0.243288 0.299205 0.361008 0.418887 0.475785 0.539550 0.598410 1. Trigonometric

Explanation / Answer

Hi

fid=fopen('TextFile.txt')

s=textscan(fid,’%d %d’)

fclose(fid)

x=s{1}

y=s{2}

p = polyfit(x, y, 1);

v = polyval(p, x);

figure(1)

plot(x,y,'x','MarkerEdgeColor','black')

hold on

plot(x, v)