when i solve the answer appers as z1 but there is no such a variable in workspace
3 次查看(过去 30 天)
显示 更早的评论
clear
syms a b c d phi(t) thi(t) beta(t) wo wb wa
assume(d,'real');
thi(t)=wa*t;
beta(t)=wb*t;
phi(t)=wo*t;
eq1=a*cos(thi(t))+b*cos(beta(t))-c*cos(phi(t))==d;%% equating real part
eq2=a*sin(thi(t))+b*sin(beta(t))-c*sin(phi(t))==0;%% equating imaginary part
eq3=cos(beta(t))*diff(eq1,t);
eq4=sin(beta(t))*diff(eq2,t);
solution=solve([eq3,eq4],wo,'ReturnConditions',true);
0 个评论
回答(1 个)
Walter Roberson
2020-3-18
If you look at solution.parameters you will find z1 listed there. Then look at solution.conditions and you will see an equation that has to be satisfied in terms of z1.
That is, the solution starts by finding all values of a temporary variable, z1, such that the conditions are satisfied, and then substituting those values in place of z1 in each of the variables in solution.
You are dealing with sines and cosines. There is probably not going to be just one solution: there is probably going to be an infinite number of solutions, and solve() tried to describe them all.
2 个评论
Walter Roberson
2020-3-18
a*wa*cos(t*wa) + b*wb*cos(t*wb) == c*z1*cos(t*z1) & ~in((t*wb)/pi, 'integer') & a*wa*sin(t*wa) + b*wb*sin(t*wb) == c*z1*sin(t*z1) & c ~= 0 & ~in((t*wb)/pi - 1/2, 'integer')
That tells you that the solution is all values of z1 such that all of these are true:
- c is not 0
- t*wb is not an integer times π
- t*wb is not (an integer plus 1/2), times π
- z1*cos(t*z1) = (a*wa*cos(t*wa) + b*wb*cos(t*wb))/c
- z1*sin(t*wa) = (a*wa*sin(t*wa) + b*wb*sin(t*wb))/c
Walter Roberson
2020-3-18
You might be looking at that and saying that does not really help, that those are pretty much just restating two of your equations. They do resolve some details of your equations, but the fundamental problem is that you are expecting closed form solutions for equations involving periodic functions, and most of the time those are not going to have nice neat solutions.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!