How to obtain matrix components

조회 수: 6 (최근 30일)
Ali Tawfik
Ali Tawfik 2019년 2월 4일
댓글: Star Strider 2019년 2월 5일
Hi All,
I am new to Matlab, and I'd like to obtain the following values: EL,VLT,VTL, and GLT from
x=[Q11 Q12 0;
Q12 Q22 0;
0 0 Q66]
the x is given equal to: =[20 0.7 0;
0.7 2 0;
0 0 0.7];
I have been trying with solve as indicated below, however, 0*1 sym is the result of each component: also maybe I should try to use subs, function but nothing working unfortunely
clear all;
clc;
close all;
syms EL vlt vtl ET GLT;
y=[EL/1-vlt*vtl vlt*ET/1-vlt*vtl 0;vlt*ET/1-vlt*vtl ET/1-vlt*vtl 0;0 0 GLT]==[20 0.7 0;0.7 2 0;0 0 0.7];
z= solve(y,EL,vlt,vtl,ET,GLT);

채택된 답변

Star Strider
Star Strider 2019년 2월 4일
You need to enclose the variables you are solving for in square brackets:
[EL,vlt,vtl,ET,GLT] = solve(y,[EL,vlt,vtl,ET,GLT]);
returning:
EL =
19
vlt =
-3/10
vtl =
10/3
ET =
1
GLT =
7/10
As desired.

추가 답변 (1개)

Ali Tawfik
Ali Tawfik 2019년 2월 5일
Hi Star, it's working, but I am not sure if the answer is correct releavant to the equations. But anyway thank you very much for your help!
  댓글 수: 1
Star Strider
Star Strider 2019년 2월 5일
As always, my pleasure!

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by