Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.90 KB | None | 0 0
  1. clear all
  2. close all
  3. clc
  4.  
  5. load c1z4dat.dat;
  6. u = c1z4dat;
  7. n = 1:length(u);
  8. %plot(u)
  9. %title("Przebieg sygnału pliku c1z4dat")
  10. %hold on
  11.  
  12. %wielomian postaci x(n) = a1*n + a0
  13. x0 = n*0+1;
  14. x1 = n;
  15. X = [x0;x1];
  16. A1 = u/X;
  17.  
  18. xp = A1 * X;
  19. %plot(xp,'r')
  20.  
  21. %wielomian postaci x(n) = a2*n^2 + a1*n + a0
  22. x0 = n*0+1;
  23. x1 = n;
  24. x2 = n.^2;
  25. X = [x0;x1;x2];
  26. A2 = u/X;
  27.  
  28. xp = A2 * X;
  29. %plot(xp,'r')
  30.  
  31. %wielomian postaci x(n) = a2*n^2 + a1*n + a0
  32. x0 = n*0+1;
  33. x1 = n;
  34. x2 = n.^2;
  35. x3 = n.^3;
  36. X = [x0;x1;x2;x3];
  37. A3 = u/X;
  38.  
  39. xp = A3 * X;
  40. %plot(xp,'r')
  41. %title('Aproksymacja 3 stopnia')
  42.  
  43. %aproksymacja wielomianem trygonometrycznym
  44.  
  45.  
  46. x0 = n*0 + 1;
  47. x1 = cos(n/80);
  48. x2 = sin(n/80);
  49. x3 = cos(n/40);
  50. x4 = sin(n/40);
  51. x5 = cos(n/20);
  52. x6 = sin(n/20);
  53.  
  54. X = [x0 ;x1; x2; x3; x4; x5; x6];
  55. A4 = u/X;
  56. xp = A4*X;
  57.  
  58. figure
  59. plot(u,'gs')
  60. hold on
  61. plot(xp,'r');
  62. title('Aproksymacja wielomianem trygonometrycznym')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement