Azzera filtri
Azzera filtri

Plot with specific x value

1 visualizzazione (ultimi 30 giorni)
Tu Nguyen
Tu Nguyen il 2 Mar 2022
Commentato: Tu Nguyen il 2 Mar 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

Risposta accettata

Cris LaPierre
Cris LaPierre il 2 Mar 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

Più risposte (0)

Categorie

Scopri di più su Inertias and Loads 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