Solving a symbolic system of equations
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sarah Peterson
am 23 Okt. 2020
Beantwortet: Stephan
am 23 Okt. 2020
I'm trying to solve a symbolic system of equations in MATLAB, but it keeps giving me zero for the variables I'm solving for. I know this isn't the answer since I worked the problem out by hand. Is there a way to use the solve function to do this?
% Equillateral Strain Rosette Problem
% angle values (A = 0, B = 120; C =60; seems to be standard for a 60 degree
% equilateral triangle)
A = 0;
B = 120;
C = 60;
% Given Angles
ThetaA = deg2rad(A); %radians for A, it always seems to start at 0
ThetaB = deg2rad(B); %in an equillateral triangle seems to be 180-interior angle
ThetaC = deg2rad(C); %seems to be just interior angle
syms strainx strainy strainxy strainA strainB strainC
strainA = (strainx+strainy)/2 + (strainx-strainy)/2*cos(2*ThetaA) + strainxy*sin(2*ThetaA);
strainB = (strainx+strainy)/2 + (strainx-strainy)/2*cos(2*ThetaB) + strainxy*sin(2*ThetaB);
strainC = (strainx+strainy)/2 + (strainx-strainy)/2*cos(2*ThetaC) + strainxy*sin(2*ThetaC);
eqns = [strainA, strainB, strainC];
vars = [strainx, strainy, strainxy];
[strainx, strainy, strainxy] = solve(eqns,vars); %Need to solve in terms of strainA strainB and strainC
0 Kommentare
Akzeptierte Antwort
Stephan
am 23 Okt. 2020
Try:
% Equillateral Strain Rosette Problem
% angle values (A = 0, B = 120; C =60; seems to be standard for a 60 degree
% equilateral triangle)
A = 0;
B = 120;
C = 60;
% Given Angles
ThetaA = deg2rad(A); %radians for A, it always seems to start at 0
ThetaB = deg2rad(B); %in an equillateral triangle seems to be 180-interior angle
ThetaC = deg2rad(C); %seems to be just interior angle
syms strainx strainy strainxy strainA strainB strainC
eq(1) = strainA == (strainx+strainy)/2 + (strainx-strainy)/2*cos(2*ThetaA) + strainxy*sin(2*ThetaA);
eq(2) = strainB == (strainx+strainy)/2 + (strainx-strainy)/2*cos(2*ThetaB) + strainxy*sin(2*ThetaB);
eq(3) = strainC == (strainx+strainy)/2 + (strainx-strainy)/2*cos(2*ThetaC) + strainxy*sin(2*ThetaC);
vars = [strainx, strainy, strainxy];
[strainx, strainy, strainxy] = solve(eq,vars) %Need to solve in terms of strainA strainB and strainC
which gives:
strainx =
strainA
strainy =
(2*strainB)/3 - strainA/3 + (2*strainC)/3
strainxy =
-(3^(1/2)*(strainB - strainC))/3
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!