2 input and one out in plot

1 Ansicht (letzte 30 Tage)
iman
iman am 24 Dez. 2013
Bearbeitet: Image Analyst am 24 Dez. 2013
in this image in example of spectrum analysis of sinusidal signals i want input plot 1 and plot 2 and i want that matlab Draw plot 3 Diagram . what commands can do this problem ? please help man tankyou
meanwhile 1 plot is cos(pi/3n)+0.75cos(2pi/3n) and 2 plot is rectangular window

Akzeptierte Antwort

Image Analyst
Image Analyst am 24 Dez. 2013
It looks like the stem() function will create that kind of plot.
  2 Kommentare
iman
iman am 24 Dez. 2013
can you help me in create that plot please
Image Analyst
Image Analyst am 24 Dez. 2013
Bearbeitet: Image Analyst am 24 Dez. 2013
Did you look at any of the 13 examples from the help? Well, here, I did it for you:
% Create data.
x = -3:11;
y1 = cos(x .* pi/3)+0.75*cos(2*x*pi/3);
y2 = [0,0,0,1,1,1,1,1,1,1,1,0,0,0,0]
y3 = y1 .* y2;
% Plot top graph.
subplot(3,1,1);
stem(x,y1, 'Color', 'k', 'MarkerFaceColor', 'k', 'LineWidth', 3);
xlim([-3,11]);
ylim([-2,2]);
grid on;
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Plot top graph.
subplot(3,1,2);
stem(x,y2, 'Color', 'k', 'MarkerFaceColor', 'k', 'LineWidth', 3);
xlim([-3,11]);
ylim([0, 1.2]);
grid on;
% Plot top graph.
subplot(3,1,3);
stem(x,y3, 'Color', 'k', 'MarkerFaceColor', 'k', 'LineWidth', 3);
xlim([-3,11]);
ylim([-2, 2]);
grid on;

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by