Pulse function with matlab

I need to do the follwing, but i am relatively new so i want to make sure it's right
Generate a pulse function with a pulse width 1 second as an input function, x(t), and use the same exponential decay function as impulse response function, h(t). Using MATLAB to calculate the output of the system y(t).
t = 0 : 1/1000 : 1;
u=0*t;
h=exp(-t/2);
y = rectpuls(t);
b=conv(h,y);
plot(b)
ohh i am lost

8 件のコメント

Paulo Silva
Paulo Silva 2011 年 2 月 25 日
Could it be something like this:
t = 0 : 1/1000 : 1;
u=ones(1,numel(t));
h=exp(-t/2);
b=conv(h,u);
c=conv(b,h);
plot(c)
Paulo Silva
Paulo Silva 2011 年 2 月 25 日
clc;clear;clf
t = 0.001 : 1/1000 : 3;
u=[zeros(1,1000) ones(1,numel(t)/3) zeros(1,1000)];
h=exp(-t/2);
b=conv(u,h);
c=conv(h,b);
hold on
plot(c./1000000)
plot(u,'r')
plot(h,'g')
legend('output','pulse','exponential decay')
gedaa
gedaa 2011 年 2 月 25 日
hey paulo, now for "u", the width is one second, not amplitude, or am i understanding it correctly
Paulo Silva
Paulo Silva 2011 年 2 月 25 日
I always assume that the amplitude is 1 and you didn't specify other value for it did you?
Paulo Silva
Paulo Silva 2011 年 2 月 25 日
If you want to change the amplitude just
Amp=1; %select here the amplitude of u
u=[zeros(1,1000) Amp*ones(1,numel(t)/3) zeros(1,1000)];
gedaa
gedaa 2011 年 2 月 25 日
no i think i will leave the amplitude since it doesn't specifiy as you said, but, if i wanted to change instead of one second width, to 0.1 second, i would change all the 1000 to 100, right?
Paulo Silva
Paulo Silva 2011 年 2 月 25 日
clc;clear;clf
T=1000; %value in miliseconds, 1000->1 second, 100->0.1 second
t = 1/T : 1/T : 3;
Amp=1 %amplitude of the pulse
u=[zeros(1,T) Amp*ones(1,numel(t)/3) zeros(1,T)];
h=exp(-t/2);
b=conv(u,h);
c=conv(h,b);
hold on
plot(c./1000000)
plot(u,'r')
plot(h,'g')
legend('output','pulse','exponential decay')
gedaa
gedaa 2011 年 2 月 25 日
thank you sooo much, ur the best

サインインしてコメントする。

回答 (1 件)

voona  srikar
voona srikar 2022 年 12 月 4 日

0 投票

t = 0 : 1/1000 : 1;
u=0*t;
h=exp(-t/2);
y = rectpuls(t);
b=conv(h,y);
plot(b)

カテゴリ

質問済み:

2011 年 2 月 24 日

回答済み:

2022 年 12 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by