Frequency = 15 ; % in Hertz
SamplingFrequency = 100*Frequency; % in Hertz. Note: Increasing the sampling frequency does not help.
Simulationtimestep = 1/SamplingFrequency; % Simulation time-step
Simulationtime=0:Simulationtimestep:1-Simulationtimestep; % Simulation time
Phasediff = deg2rad(20); % in radians
Amplitude = 2;
Wave1 = Amplitude*sin(2*pi*Frequency*Simulationtime); % Reference Wave
Wave2 = Amplitude*sin(2*pi*Frequency*Simulationtime+Phasediff ); % Wave with phase difference
disp(max(Wave1));%Should be equal to 2
Wave1Peaks = numel(find(Wave1==Amplitude)); % Should be equal to the frequency (15)
disp(max(Wave2)); %Should be equal to 2
Wave2Peaks = numel(find(Wave2==Amplitude)); % Should be equal to the frequency (15)
Best Answer