Solve out a symbol
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Pouyan Msgn
am 7 Jul. 2019
Kommentiert: Pouyan Msgn
am 7 Jul. 2019
Hi I have the formula :
k=w*sqrt(e*m/2)*sqrt(sqrt(1+(s/(w*e))^2)-1)
And I will solve out s:
clc
clear all
syms k w m e s
k=w*sqrt(e*m/2)*sqrt(sqrt(1+(s/(w*e))^2)-1)
solve(k,s)
But the problem is this :
Warning: The solutions are valid under the following conditions: e ~= 0 & w ~= 0. To include parameters and
conditions in the solution, specify the 'ReturnConditions' option.
> In solve>warnIfParams (line 517)
In solve (line 360)
ans=0
Can I get s by using Matlab?
0 Kommentare
Akzeptierte Antwort
infinity
am 7 Jul. 2019
Hello,
If you write
solve(k,s)
the solve function will solve another equation k == 0, i.e,
w*sqrt(e*m/2)*sqrt(sqrt(1+(s/(w*e))^2)-1) == 0
which is not what you want to solve. Also, obviously, s = 0 is the solution of this equation.
So, you may change your code litle bit as follows
clc
clear
syms k w m e s
f=w*sqrt(e*m/2)*sqrt(sqrt(1+(s/(w*e))^2)-1)
[sol,~,conditions] = solve(f==k,s,'ReturnConditions', true)
It will give the results
sol =
-(2*k*(k^2 + e*m*w^2)^(1/2))/(m*w)
(2*k*(k^2 + e*m*w^2)^(1/2))/(m*w)
conditions =
signIm((k*1i)/(w*((e*m)/2)^(1/2))) == 1 & signIm((k^2*2i)/(e*m*w^2) + 1i) == 1
signIm((k*1i)/(w*((e*m)/2)^(1/2))) == 1 & signIm((k^2*2i)/(e*m*w^2) + 1i) == 1
1 Kommentar
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!