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

3 visualizzazioni (ultimi 30 giorni)
Tianchu Lu il 27 Nov 2020
Risposto: Alan Moses il 2 Dic 2020
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 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Alan Moses il 2 Dic 2020
You may refer to this link posted in the answer to a similar question here.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Axis Labels in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by