System unit-impulse response for given tau

4 visualizaciones (últimos 30 días)
Thomas Marshall
Thomas Marshall el 18 de Nov. de 2019
Editada: M el 20 de Nov. de 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)
plot(t,x1(t))
subplot(t,x2(t))

Respuestas (1)

M
M el 20 de Nov. de 2019
Editada: M el 20 de Nov. de 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

Categorías

Más información sobre Acoustics, Noise and Vibration en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by