MATLAB Answers

System unit-impulse response for given tau

3 views (last 30 days)
Thomas Marshall
Thomas Marshall on 18 Nov 2019
Edited: M on 20 Nov 2019
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)

Answers (1)

M on 20 Nov 2019
Edited: M on 20 Nov 2019
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

Community Treasure Hunt

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

Start Hunting!