How o you work the phase difference between the input and the output of a sine wave?
2 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!