# System unit-impulse response for given tau

조회 수: 6(최근 30일)
Thomas Marshall 2019년 11월 18일
편집: M 2019년 11월 20일
I am having trouble trying to plot two impulse reponses based off of given tau values over the time interval 0 < t < 2. Below is what I have to start before plotting x1 and x2 vs time, t. I keep getting an error message based on t being a matrix and not being able to divide it by t in the response equations x1 & x2? How would I go about tyring to graph this and fix the time error that keeps generating?
tau1 = 0.25;
tau2 = 0.75;
A = randn(0,5);
t = 0:0.1:2
x1 = (A/tau1)*exp(t/-tau1)
x2 = (A/tau2)*exp(t/-tau2)
plot(t,x1(t))
subplot(t,x2(t))

댓글을 달려면 로그인하십시오.

### 답변(1개)

M 2019년 11월 20일
편집: M 2019년 11월 20일
There is a problem of dimensions for matrix multiplication at line 5 and 6 :
x1 = (A/tau1)*exp(t/-tau1)
x2 = (A/tau2)*exp(t/-tau2)
If you look at :
A_t = A/tau1
size(A_t)= 0 5
Because A = randn(0.5), but randn(M) returns an M-by-M matrix.
so inside the randn() function, you should select an integer value > 0.
Replace 0.5 by 1 should work.
Then you will have a problem when plotting.
Note that you do not need x1(t) but simply x1.
Finally, either use subplot for both x1 and x2 or use plot for both and see the hold command

댓글을 달려면 로그인하십시오.

R2019b

### Community Treasure Hunt

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

Start Hunting!

Translated by