How o you work the phase difference between the input and the output of a sine wave?

5 views (last 30 days)
Here is my code:
n = 0:49; % These are the time indices
input = 7*cos(2*pi*0.125*n+pi/3);
input_a = 2*input;
input_b = 8*cos(2*pi*0.25*n);
input_c = input_a + input_b;
b = [5, -5]; % The filter coefficients
y = conv(b,input); % The output signal
y_a = conv(b,input_a);
y_b = conv(b,input_b);
y_c = conv(b,input_c);
subplot(2,2,1);
plot(input, 'b*-'); % Plot the input as a blue line
hold on;
plot(y, 'r.-'); % Plot the output as a red line
hold on;
xlabel('Time'); % Label x axis
ylabel('Amplitude'); % Label y axis
subplot(2,2,2);
plot(input_a, 'b*-'); % Plot the input as a blue line
hold on;
plot(y_a, 'r.-'); % Plot the output as a red line
hold on;
xlabel('Time'); % Label x axis
ylabel('Amplitude'); % Label y axis
subplot(2,2,3);
plot(input_b, 'b*-'); % Plot the input as a blue line
hold on;
plot(y_b, 'r.-'); % Plot the output as a red line
hold on;
xlabel('Time'); % Label x axis
ylabel('Amplitude'); % Label y axis
subplot(2,2,4);
plot(input_c, 'b*-'); % Plot the input as a blue line
hold on;
plot(y_c, 'r.-'); % Plot the output as a red line
hold on;
xlabel('Time'); % Label x axis
ylabel('Amplitude'); % Label y axis
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
How do i work the phase difference between the output of y_b to the input and the phase difference of y_c to the input.

Accepted Answer

Alan Moses
Alan Moses on 2 Dec 2020
You may refer to this link posted in the answer to a similar question here.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!