difference between these 2 graphs when i put (-acos) and when i put (acos only)

1 view (last 30 days)
Hello Guys
Here is a code that i built of trying to plot a sine wave signal by using two methods:
1) 1st method was by a sine wave from certain parameters (cf code below)
2) the second method was looking from the plot of the first question and rebuilding the same sine wave by extracting the (Frequency , Amplitude and phase ) values which i managed to do
when calculating the phase i used -acos instead of cos to match the 2nd wave with the 1st one , but when i use cos only the signal is delayed(cf the plots below) . can you please tell me why this is giving me a delayed plot on (acos) when theoritacally it should give me the same plot ?
please check my code and plot below
%1st method just initialising the signal values and ploting
clear all;
close all;
%2nd method looking from the plot of the first signal and rebuilding
%the signal by using the sine wave parameters . (Frequency ,Amplitude and phase)
f=2.2; % frequency from the plot en Hz
a=find(t>=0); % creation of the 1st value>0 from the time space
Phi=-acos((s1(a(1)))/max(s1)) % Phi is calculated when t=o from the {s1=cos(2*pi*f*t + phi)}
% Phi=-acos(s1(t=0)) or Phi=acos(s1(t=0)){when i use cos instead of -cos the signal is delayed [why?]}
plot(t,s1), hold on
xlabel('Temps (s)'), ylabel('Signal sl(t)')
legend('Signal source', 'Signal reconstruit'
  1 Comment
darova on 26 Feb 2020
I don't know what are you doing but Phi is just shift if phase
So you can move you cos() whatever you want with Phi

Sign in to comment.

Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!