Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

Learn polyfit and polyval functions with code

Vfm =[2.428 2.6473 2.9398 3.5704 3.8994 ];

 Ifm = [1.1691 9.2942 20.9015 43.5356 55.7233 ];

 figure(1),plot(Vfm,Ifm,'o-')

 C = polyfit(Vfm,Ifm,1);

 Vf = 2.4:0.000001:3.8;

 If = C(1)*Vf+C(2);

 plot(Vfm,Ifm,'o',Vf,If)

 % polyval

 C = polyfit(Vfm,Ifm,1);

 If = polyval(C,Vf);

 plot(Vfm,Ifm,'o',Vf,If)

 xlabel('V_F(V)')

 ylabel('I_F(mA)')

 title('laboratory 1 graph')

 grid

 legend('data','fitted line')

 

 





Join us on Telegram: https://t.me/matlabcastor

No comments

Popular Posts