How to solve equations in variable terms?

4 次查看(过去 30 天)
I wanted to find equation solving a, b, c, and d in terms of e, f, g, and h. Is it possible to do this in MATLAB? Here's my code for the moment.
clc
clear all
syms a b c d e f g h alpha
A = [a b; c d];
R = [cos(alpha) -sin(alpha); sin(alpha) cos(alpha)];
D = (R*A)*transpose(R);
e=D(1,1)
e = 
f=D(1,2)
f = 
g=D(2,1)
g = 
h=D(2,2)
h = 
eqn=[e f g h];
solver=solve(eqn,[a b c d])
solver = struct with fields:
a: 0 b: 0 c: 0 d: 0

采纳的回答

Dyuman Joshi
Dyuman Joshi 2023-4-21
syms a b c d e f g h alpha
A = [a b; c d];
R = [cos(alpha) -sin(alpha); sin(alpha) cos(alpha)];
D = (R*A)*transpose(R);
%Modify the equations
eq1 = e-D(1,1)==0;
eq2 = f-D(1,2)==0;
eq3 = g-D(2,1)==0;
eq4 = h-D(2,2)==0;
eqn=[eq1 eq2 eq3 eq4];
solver=solve(eqn,[a b c d])
solver = struct with fields:
a: (e*cos(alpha)^2 + h*sin(alpha)^2 + f*cos(alpha)*sin(alpha) + g*cos(alpha)*sin(alpha))/(cos(alpha)^2 + sin(alpha)^2)^2 b: (f*cos(alpha)^2 - g*sin(alpha)^2 - e*cos(alpha)*sin(alpha) + h*cos(alpha)*sin(alpha))/(cos(alpha)^2 + sin(alpha)^2)^2 c: (g*cos(alpha)^2 - f*sin(alpha)^2 - e*cos(alpha)*sin(alpha) + h*cos(alpha)*sin(alpha))/(cos(alpha)^2 + sin(alpha)^2)^2 d: (h*cos(alpha)^2 + e*sin(alpha)^2 - f*cos(alpha)*sin(alpha) - g*cos(alpha)*sin(alpha))/(cos(alpha)^4 + sin(alpha)^4 + 2*cos(alpha)^2*sin(alpha)^2)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Particle & Nuclear Physics 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by