Advertisement
Guest User

Untitled

a guest
Apr 9th, 2017
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.61 KB | None | 0 0
  1. close all,clear all
  2. x=2:45:722; y=[0.0175902,0.30468,0.64733,0.94591,0.9588,0.80693,0.66372,0.55691,0.47833,0.41902,0.37288,0.33603,0.30592,0.28085,0.25965,0.24147,0.22571];
  3. xi=2:20:722;
  4. xii=2:0.1:722;
  5. yi=interp1(x,y,xi,'spline');
  6. m=[1 1010 1.01*1e6];%współczynniki wielomianu w mianowniku
  7. s=j*2*pi*xii;
  8. hs=1000*(s+10)./polyval(m,s);
  9. A=abs(hs);
  10. plot(x,y,'or',xi,yi,'o',xii,A),grid,legend("Pomiar","Interpolacja","Teoria"),xlabel("f [hz]"),ylabel("A");
  11. %aproksymacja
  12. a=polyfit(x,y,8);
  13. y2=polyval(a,x);
  14. figure(2),plot(x,y,'o',xii,A,x,y2),grid,legend("Pomiar","Aproksymacja","Teoria"),xlabel("f [hz]"),ylabel("A");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement