Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- close all
- clear all
- load acq.mat
- %Initialisation variable
- w0 = 2*pi*(fin/fs);
- w=w0*linspace(1-0.0002,1+0.0002,200);
- C=zeros(1,200);
- A=zeros(1,200);
- phi=zeros(1,200);
- variance=zeros(1,200);
- %Création de la matrice C,A,phi pour chaque valeur de w
- for index=1:length(w)
- Cj=Erreur(w(index),n,data); %ne pas écraser chacune des valeurs
- % C,A,phi
- a0=Cj(1);
- a1=Cj(2);
- a2=Cj(3);
- C(index)=a0;
- A(index)=sqrt((a1^2)+(a2^2));
- phi(index)=atan(a2/a1);
- Vn = Cj(2,:)*sin(w(index)*n)+Cj(3,:)*cos(w(index)*n)+Cj(1,:); % Vn = a1*sin(w*n) + a2*cos(w*n) + a0
- E=Vn-data;
- variance(:,index)=var(E)
- end
- %tracés
- figure(1)
- plot(n,data,'*',n,Vn,'red') %valeurs expérimentales pour chaques échantillons
- legend('data','Vn');
- title('Variation de erreur en fonction de la pulsation')
- figure(2)
- plot(w,variance) % signal d'erreur
- title('signal erreur')
- figure(3)
- subplot(2,2,1)
- plot(w,variance) % signal d'erreur
- title('variance en fonction de la pulsation')
- subplot(2,2,2)
- plot(w,A)
- xlabel('w');
- ylabel('A');
- title('Tracé de amplitude A en fonction de la pulsation');
- subplot(2,2,3)
- plot(w,C)
- xlabel('w');
- ylabel('C');
- title('Tracé de offset C en fonction de la pulsation');
- subplot(2,2,4)
- plot(w,phi)
- xlabel('w');
- ylabel('phi');
- title('Tracé de la phase phi en fonction de la pulsation');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement