how to verify that the phase of the two signals x1(t) and x2(t) is correct at t = 0, and also verify that each one has the correct maximum amplitude.

4 views (last 30 days)
%%task4_2
clc
clear all
close all
taxis= linspace(-10,10, 200);
taxis=taxis/20;
A=5;
f=15; %15 hertz sinusoids
x1= A* cos((2*pi*f*taxis)+0.5*pi);
x2= A* cos((2*pi*f*taxis)-0.25*pi);
x3= A* cos((2*pi*f*taxis)+0.4*pi);
x4= A* cos((2*pi*f*taxis)-0.9*pi);
x5=x1+x2+x3+x4;
% phase difference measurement
phsdifference = phasedifference(x1, x5);
phsdifference = rad2deg(phsdifference);
% display the phase difference
disp(['Phase difference of x5 from x1= ' num2str(phsdifference) ' deg'])
figure (1)
subplot(5,1,1);
plot(taxis,x1, 'r');
title('sinusoid x1 with 15 hertz');
xlabel('Time (s)');
ylabel('Amplitudes');
legend('x1');
subplot(5,1,2);
plot(taxis, x2, 'k');
title('sinusoid x2 with 15 hertz');
xlabel('Time (s)');
ylabel('Amplitudes');
legend('x2');
subplot(5,1,3)
plot(taxis, x3, 'g');
title('sinusoid x3=(x1+x2) with 15 hertz');
xlabel('Time (s)');
ylabel('Amplitudes');
legend('x3');
subplot(5,1,4)
plot(taxis, x4, 'b');
title('sinusoid x4 with 15 hertz');
xlabel('Time (s)');
ylabel('Amplitudes');
legend('x4');
subplot(5,1,5)
plot(taxis, x5, 'm');
title('sinusoid x5 with 15 hertz');
xlabel('Time (s)');
ylabel('Amplitudes');
legend('x5');

Answers (1)

SaiDileep Kola
SaiDileep Kola on 26 Feb 2021
You may get some help with discussion here

Community Treasure Hunt

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

Start Hunting!