Multiplying a matrix by a function

조회 수: 21 (최근 30일)
Denikka Brent
Denikka Brent 2018년 10월 19일
답변: possibility 2018년 10월 19일
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
Denikka Brent
Denikka Brent 2018년 10월 19일
n(t) is a function dependent on time. When solved in matlab it shows to be a vector of columns 1-100
James Tursa
James Tursa 2018년 10월 19일
Is the first dimension of the n(t) result 5? If not, how are you supposed to multiply it by P?

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

답변 (1개)

possibility
possibility 2018년 10월 19일

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

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by