Multiplying a matrix by a function
Ältere Kommentare anzeigen
How can I multiply a matrix by a function of time so that my answer is a time dependent function?
For example: say u(t)=P*n(t)
n(t) is a function of time and P is a 5x5 matrix. I am trying to put this in matlab so that I can graph u(t) vs time.
3 Kommentare
James Tursa
am 19 Okt. 2018
What is n(t)? Is it a vectorized m-file function? A vectorized function handle? Does it return a 5xN matrix? Or ...?
Denikka Brent
am 19 Okt. 2018
James Tursa
am 19 Okt. 2018
Is the first dimension of the n(t) result 5? If not, how are you supposed to multiply it by P?
Antworten (1)
possibility
am 19 Okt. 2018
0 Stimmen
I am assuming P to be 5 X 5 matrix and n(t) to be 5x100. Hence, if you do the calculation
u(t) = P*n(t) , you are going to get u(t), a 5x100 matrix (same dimension of n(t)).
You can do it in a for loop
for i=1:size(n,1) u(i,:)=P(:,i).*n(i,:) end
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!