Plot with specific x value
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Tu Nguyen
am 2 Mär. 2022
Kommentiert: Tu Nguyen
am 2 Mär. 2022
clc;
close all;
clear all;
x1= [1 2 3 4 5];
L = 2;
n = linspace(0,4,10);
m =linspace(0,10,10);
h1 = dirac(n - m*L);
idx = h1 == Inf;
h1(idx) = 1;
h2 = dirac(n-m/L);
idx = h2 == Inf;
h2(idx) = 1;
y1 = conv(x1,h1);
y2 = conv(x1,h2);
subplot(1,2,1);
stem(y1);
subplot(1,2,2);
stem(y2);
Hi all, I just want to stem y1 and y2 on x coordiante from 0 to 10. How can I do that? If I set stem(y1,[0 10]), it returns X and Y must have same dimension. Please help me
0 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 2 Mär. 2022
Use xlim?
x1= [1 2 3 4 5];
L = 2;
n = linspace(0,4,10);
m =linspace(0,10,10);
h1 = dirac(n - m*L);
idx = h1 == Inf;
h1(idx) = 1;
h2 = dirac(n-m/L);
idx = h2 == Inf;
h2(idx) = 1;
y1 = conv(x1,h1);
y2 = conv(x1,h2);
subplot(1,2,1);
stem(y1);
xlim([0 10]) % xlim
subplot(1,2,2);
stem(y2);
xlim([0 10]) % xlim
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Inertias and Loads finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!