How to solve matrix as a function

조회 수: 1 (최근 30일)
Josh
Josh 2012년 2월 15일
I know this is simple for some, but I need a hand. I am learning this as I go with no assistance.
If I have three known variables, or 3x1 matrix Theta. I know m=cosd(Theta), and n=sind(Theta), and I want to solve another matrix T for each of the three Theta, how would you code this?
Ex: T = [m^2,n^2,2mn; n^2,m^2,-2mn; m,n,m^2n^2]
How can I enter this in and get three separate T matrices as my output? Thanks!

답변 (3개)

Benjamin Schwabe
Benjamin Schwabe 2012년 2월 15일
What does m^2 mean? It's a vecor, isn't it? Componentwise operation? Or is it a real vecor-vectormultiplication resulting in a single number?
  댓글 수: 1
Josh
Josh 2012년 2월 15일
m^2 is m squared, which will be a number in row1, column1. Likewise, n^2 is in row 1, column2, and so on. m=cosd(Theta). I am just trying to find the code where I can solve for all Thetas at once.

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


Walter Roberson
Walter Roberson 2012년 2월 15일

Andrei Bobrov
Andrei Bobrov 2012년 2월 15일
m = reshape(cosd(Theta),1,1,[])
mq = m.^2;
nq = 1 - mq;
n = sqrt(nq);
mn = 2*m.*n;
T = [mq, nq, mn; nq,mq,-mn; m,n,mq.*nq]

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by