필터 지우기
필터 지우기

subtraction and multiplication of two arrays

조회 수: 1 (최근 30일)
Bathrinath
Bathrinath 2014년 6월 11일
댓글: Bathrinath 2014년 6월 11일
t=[19;25;29;69];T=[19;25;29;69]; i have to do the subtraction and multiplication operation using A=0.3*(t-T) to get 4X4 matrix. It is 4X4 matrix in the first column T=19 is constant similarly second T=25 is constant.third column T=29 is constant and in fourth column T=69 is constant. By using A i will get the result. my answer has to be A=[0,-0.54,-3,-15;1.8,0,-1.2,-13.2;3,1.2,0,-12;15,13.2,12,0]; Initially A will be zeros(length(t),length(T)). Suggest some points

채택된 답변

Roger Stafford
Roger Stafford 2014년 6월 11일
A = 0.3*bsxfun(@minus,t,T');
This gives the result you have specified except for the -0.54 at (1,2). I think that may be an error on your part.
  댓글 수: 1
Bathrinath
Bathrinath 2014년 6월 11일
Thank you very much sir. " I don't know how you people are doing programming like this!".Congrats sir.

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

추가 답변 (1개)

pietro
pietro 2014년 6월 11일
As you did:
A=0.3*(t-T)
but in your example t and T are equal, so the result is an array full of zeros
  댓글 수: 1
Bathrinath
Bathrinath 2014년 6월 11일
It is 4X4 matrix in the first column T=19 is constant similarly second T=25 is constant.third column T=29 is constant and in fourth column T=69 is constant. By using A i will get the result.

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

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by