vpasolve giving incorrect answers for a system of trigonometric equations. Where’s the error??
I’m trying to use vpasolve to solve a system of trigonomic equations. Known variables are Sa1, Sa2, and Sa3. Unknown variables are S, AR, PHI. The code hasn’t been giving me the correct results, but I can’t figure out where the error is.
Can someone with sharper eyes spot the problem?
I assigned fake values for the unknown variables, so I could calculate known variable values to test.
%locations of observation points
x1 = -9.72; y1 = -5.62; %OBS4
x2 = -4.95; y2 = -5.60; %OBS5
x3 = 6.63; y3 = -3.76; %OBS6
%assign fake values to unknown variables
S = 3.4e-5; AR = 10; PHI = 36;
%interim variables
W1 = ((-x1*sind(PHI) + y1*cosd(PHI)) / (y1*sind(PHI) + x1*cosd(PHI)));
W2 = ((-x2*sind(PHI) + y2*cosd(PHI)) / (y2*sind(PHI) + x2*cosd(PHI)));
W3 = ((-x3*sind(PHI) + y3*cosd(PHI)) / (y3*sind(PHI) + x3*cosd(PHI)));
%calculate known variable values to test
Sa1 = S*(sqrt(AR^-1)*(cosd(W1))^2+sqrt(AR)*(sind(W1))^2)
Sa2 = S*(sqrt(AR^-1)*(cosd(W2))^2+sqrt(AR)*(sind(W2))^2)
Sa3 = S*(sqrt(AR^-1)*(cosd(W3))^2+sqrt(AR)*(sind(W3))^2)
The above returns Sa1 = 1.0752e-05, Sa2 = 1.0753e-05, and Sa3 = 1.0894e-05.
Having created known variable values with my fake unknown variable values, I’m not able to return the numbers I assigned. The code below is what I’m trying to use in my project.
syms S AR PHI
%locations of observation points
x1 = -9.72; y1 = -5.62; %OBS4
x2 = -4.95; y2 = -5.60; %OBS5
x3 = 6.63; y3 = -3.76; %OBS6
%values for known variables
Sa1 = 1.0752e-05;
Sa2 = 1.0753e-05;
Sa3 = 1.0894e-05;
%interim variables
W1 = ((-x1*sind(PHI) + y1*cosd(PHI)) / (y1*sind(PHI) + x1*cosd(PHI)));
W2 = ((-x2*sind(PHI) + y2*cosd(PHI)) / (y2*sind(PHI) + x2*cosd(PHI)));
W3 = ((-x3*sind(PHI) + y3*cosd(PHI)) / (y3*sind(PHI) + x3*cosd(PHI)));
%define system of equations and solve
EQN = [Sa1 == S*(sqrt(AR^-1)*(cosd(W1))^2+sqrt(AR)*(sind(W1))^2), …
Sa2 == S*(sqrt(AR^-1)*(cosd(W2))^2+sqrt(AR)*(sind(W2))^2), …
Sa3 == S*(sqrt(AR^-1)*(cosd(W3))^2+sqrt(AR)*(sind(W3))^2)];
[S,AR,PHI] = vpasolve(EQN)
The above code returns nonsense. Why?I’m trying to use vpasolve to solve a system of trigonomic equations. Known variables are Sa1, Sa2, and Sa3. Unknown variables are S, AR, PHI. The code hasn’t been giving me the correct results, but I can’t figure out where the error is.
Can someone with sharper eyes spot the problem?
I assigned fake values for the unknown variables, so I could calculate known variable values to test.
%locations of observation points
x1 = -9.72; y1 = -5.62; %OBS4
x2 = -4.95; y2 = -5.60; %OBS5
x3 = 6.63; y3 = -3.76; %OBS6
%assign fake values to unknown variables
S = 3.4e-5; AR = 10; PHI = 36;
%interim variables
W1 = ((-x1*sind(PHI) + y1*cosd(PHI)) / (y1*sind(PHI) + x1*cosd(PHI)));
W2 = ((-x2*sind(PHI) + y2*cosd(PHI)) / (y2*sind(PHI) + x2*cosd(PHI)));
W3 = ((-x3*sind(PHI) + y3*cosd(PHI)) / (y3*sind(PHI) + x3*cosd(PHI)));
%calculate known variable values to test
Sa1 = S*(sqrt(AR^-1)*(cosd(W1))^2+sqrt(AR)*(sind(W1))^2)
Sa2 = S*(sqrt(AR^-1)*(cosd(W2))^2+sqrt(AR)*(sind(W2))^2)
Sa3 = S*(sqrt(AR^-1)*(cosd(W3))^2+sqrt(AR)*(sind(W3))^2)
The above returns Sa1 = 1.0752e-05, Sa2 = 1.0753e-05, and Sa3 = 1.0894e-05.
Having created known variable values with my fake unknown variable values, I’m not able to return the numbers I assigned. The code below is what I’m trying to use in my project.
syms S AR PHI
%locations of observation points
x1 = -9.72; y1 = -5.62; %OBS4
x2 = -4.95; y2 = -5.60; %OBS5
x3 = 6.63; y3 = -3.76; %OBS6
%values for known variables
Sa1 = 1.0752e-05;
Sa2 = 1.0753e-05;
Sa3 = 1.0894e-05;
%interim variables
W1 = ((-x1*sind(PHI) + y1*cosd(PHI)) / (y1*sind(PHI) + x1*cosd(PHI)));
W2 = ((-x2*sind(PHI) + y2*cosd(PHI)) / (y2*sind(PHI) + x2*cosd(PHI)));
W3 = ((-x3*sind(PHI) + y3*cosd(PHI)) / (y3*sind(PHI) + x3*cosd(PHI)));
%define system of equations and solve
EQN = [Sa1 == S*(sqrt(AR^-1)*(cosd(W1))^2+sqrt(AR)*(sind(W1))^2), …
Sa2 == S*(sqrt(AR^-1)*(cosd(W2))^2+sqrt(AR)*(sind(W2))^2), …
Sa3 == S*(sqrt(AR^-1)*(cosd(W3))^2+sqrt(AR)*(sind(W3))^2)];
[S,AR,PHI] = vpasolve(EQN)
The above code returns nonsense. Why? I’m trying to use vpasolve to solve a system of trigonomic equations. Known variables are Sa1, Sa2, and Sa3. Unknown variables are S, AR, PHI. The code hasn’t been giving me the correct results, but I can’t figure out where the error is.
Can someone with sharper eyes spot the problem?
I assigned fake values for the unknown variables, so I could calculate known variable values to test.
%locations of observation points
x1 = -9.72; y1 = -5.62; %OBS4
x2 = -4.95; y2 = -5.60; %OBS5
x3 = 6.63; y3 = -3.76; %OBS6
%assign fake values to unknown variables
S = 3.4e-5; AR = 10; PHI = 36;
%interim variables
W1 = ((-x1*sind(PHI) + y1*cosd(PHI)) / (y1*sind(PHI) + x1*cosd(PHI)));
W2 = ((-x2*sind(PHI) + y2*cosd(PHI)) / (y2*sind(PHI) + x2*cosd(PHI)));
W3 = ((-x3*sind(PHI) + y3*cosd(PHI)) / (y3*sind(PHI) + x3*cosd(PHI)));
%calculate known variable values to test
Sa1 = S*(sqrt(AR^-1)*(cosd(W1))^2+sqrt(AR)*(sind(W1))^2)
Sa2 = S*(sqrt(AR^-1)*(cosd(W2))^2+sqrt(AR)*(sind(W2))^2)
Sa3 = S*(sqrt(AR^-1)*(cosd(W3))^2+sqrt(AR)*(sind(W3))^2)
The above returns Sa1 = 1.0752e-05, Sa2 = 1.0753e-05, and Sa3 = 1.0894e-05.
Having created known variable values with my fake unknown variable values, I’m not able to return the numbers I assigned. The code below is what I’m trying to use in my project.
syms S AR PHI
%locations of observation points
x1 = -9.72; y1 = -5.62; %OBS4
x2 = -4.95; y2 = -5.60; %OBS5
x3 = 6.63; y3 = -3.76; %OBS6
%values for known variables
Sa1 = 1.0752e-05;
Sa2 = 1.0753e-05;
Sa3 = 1.0894e-05;
%interim variables
W1 = ((-x1*sind(PHI) + y1*cosd(PHI)) / (y1*sind(PHI) + x1*cosd(PHI)));
W2 = ((-x2*sind(PHI) + y2*cosd(PHI)) / (y2*sind(PHI) + x2*cosd(PHI)));
W3 = ((-x3*sind(PHI) + y3*cosd(PHI)) / (y3*sind(PHI) + x3*cosd(PHI)));
%define system of equations and solve
EQN = [Sa1 == S*(sqrt(AR^-1)*(cosd(W1))^2+sqrt(AR)*(sind(W1))^2), …
Sa2 == S*(sqrt(AR^-1)*(cosd(W2))^2+sqrt(AR)*(sind(W2))^2), …
Sa3 == S*(sqrt(AR^-1)*(cosd(W3))^2+sqrt(AR)*(sind(W3))^2)];
[S,AR,PHI] = vpasolve(EQN)
The above code returns nonsense. Why? vpasolv, symbolic MATLAB Answers — New Questions