symbolic equation Empty sym: 0-by-1

9 次查看(过去 30 天)
george brown
george brown 2018-3-18
评论: Rik 2020-8-11
here's the command line instruction I issue:-
solve('xw = xo+sin(xo)*180/pi',xo)
but I get:- ans = Empty sym: 0-by-1
I'm obviously new to Matlab...any help appreciated..Thanks
  5 个评论
Walter Roberson
Walter Roberson 2018-3-18
When I test your equation with xw arbitrarily set to sqrt(2) or 10, I find 36 or 38 real solutions: which one did you need?
george brown
george brown 2018-3-19
First of all , thanks for your interest and you're absolutely correct I did want to get the sin of a value in degrees so it should indeed be sind().
Here's some info about what I'm working on.
The equation shown relates to warping (time shifting) the time locations of (angular) values along the time axis of a sine wave ...essentially warping the sine waveform. The equation calculates a time shift (angular shift) that is dependant on the instantaneous values of amplitude of the original unwarped sine wave. This amplitude instantaneous amplitude is multiplied by the 180/pi which is an offset coefficient (as you say one radian converted to degrees) because the time axis is in degrees in this version of the equation.
positive amplitudes (angles between zero and 180 degress result in time advancing and angles between 180 and 360 result in time retarding.
For example if xo is the peak (90 degree) value of the original sine wave ( xo stands for x original) the angular x value is shifted to a new "time warped" location on the x axis (xw stands for x warped)
so using the equation ....when xo is 90 degrees xw is 147.29 degrees
xw = xo+sind(xo)*180/pi
xw = 90 + sind(90) * 180/pi xw = 147.2958 degrees
or
when xo is 30 degrees xw is 58.6479 xw = 30 + sind(30) * 180/pi xw = 58.6479 degrees
Note that when xo is 0 degrees a zero time shift results and xo = xw
So the equation represents an amplitude dependant time shift of point values on a sine wave.
Here's a graph showing 10 sine waves of various amplitudes and their resulting time warped equivalents.
I'll be working in samples along the axis ultimately but for now i'm working in angles just until I get my basic math ironed out.
Without going into further detail...as I say I need to rewrite the equation to solve for xo given an xw value....because the y value that matches xw is actually the same amplitude as the y value for xo....that is the sind(xo)
This probaly sounds awfully confusing coming in cold. Anyway thanks for you help so far and I certainly understand if you leave it at that. I probbaly need to spend more than just a few hours on matlab before inflicting stupid questions on you fine folk.

请先登录,再进行评论。

回答(2 个)

John D'Errico
John D'Errico 2018-3-18
编辑:John D'Errico 2018-3-18
Being new is irrelevant. This is just a question of mathematics. Sym produces an empty result because there is no analytical solution to the problem posed. It is trivially simple to write an expression with no analytical solution. You just proved that by example.
If you have a specific value for xw, then use a tool like fzero or vpasolve, that will be able to provide a numerical root finding solution. Even there, you may need to beware, because there may be still no solution, or there may be multiple solutions, and the rootfinder will only provide a single solution. In the latter case, it will depend on the starting point for the solver.
  1 个评论
george brown
george brown 2018-3-18
thanks for your response. I'll need to read about fzero and vpasolve. I just need to rewrite the equation to solve for xo for a given value of xw and I was following an example I'd seen on solving algebraic equations symbolically.

请先登录,再进行评论。


qasem qasem
qasem qasem 2020-8-10
here's the command line instruction I issue:-
syms a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18...
a19 a20
eqn0=-2*(-(e*a0)-x2*a1-x3*a2-x2*a3-x3*a4-x4*a5-x5*a6-x2*a7-x3*a8-x4*a9-...
x5*a10-x6*a11-x7*a12-x2*a13-x3*a14-x4*a15-x5*a16-x6*a17-x7*a18-x8*a19...
-x9*a20)==2*x1;
eqn1=-2*(-x2*a0-xx2*a1-xx3*a2-xx2*a3-xx3*a4-xx4*a5-xx5*a6-xx2*a7-xx3*a8-xx4*a9-...
xx5*a10-xx6*a11-xx7*a12-xx2*a13-xx3*a14-xx4*a15-xx5*a16-xx6*a17-xx7*a18-xx8*a19...
-xx9*a20)==2*xx1;
eqn2=-2*(-x3*a0-rr2*a1-rr3*a2-rr2*a3-rr3*a4-rr4*a5-rr5*a6-rr2*a7-rr3*a8-rr4*a9-...
rr5*a10-rr6*a11-rr7*a12-rr2*a13-rr3*a14-rr4*a15-rr5*a16-rr6*a17-rr7*a18-rr8*a19...
-rr9*a20)==2*rr1;
eqn3=-2*(-x2*a0-xx2*a1-xx3*a2-xx2*a3-xx3*a4-xx4*a5-xx5*a6-xx2*a7-xx3*a8-xx4*a9-...
xx5*a10-xx6*a11-xx7*a12-xx2*a13-xx3*a14-xx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-ww7*a18-ww8*a19...
-ww9*a20)==2*ww1;
eqn10=-2*(-x5*a0-ee2*a1-ee3*a2-ee2*a3-ee3*a4-ee4*a5-ee5*a6-ee2*a7-ee3*a8-ee4*a9-...
ee5*a10-ee6*a11-ee7*a12-ee2*a13-ee3*a14-ee4*a15-ee5*a16-ee6*a17-ee7*a18-ee8*a19...
-ee9*a20)==2*ee1;
eqn11=-2*(-x6*a0-yy2*a1-yy3*a2-yy2*a3-yy3*a4-yy4*a5-yy5*a6-yy2*a7-yy3*a8-yy4*a9-...
yy5*a10-yy6*a11-yy7*a12-yy2*a13-yy3*a14-yy4*a15-yy5*a16-yy6*a17-yy7*a18-yy8*a19...
-yy9*a20)==2*yy1;
eqn12=-2*(-x7*a0-uu2*a1-uu3*a2-uu2*a3-uu3*a4-uu4*a5-uu5*a6-uu2*a7-uu3*a8-uu4*a9-...
uu5*a10-uu6*a11-uu7*a12-uu2*a13-uu3*a14-uu4*a15-uu5*a16-uu6*a17-uu7*a18-uu8*a19...
-uu9*a20)==2*uu1;
eqn13=-2*(-x2*a0-xx2*a1-xx3*a2-xx2*a3-xx3*a4-xx4*a5-xx5*a6-xx2*a7-xx3*a8-xx4*a9-...
xx5*a10-xx6*a11-xx7*a12-xx2*a13-xx3*a14-xx4*a15-xx5*a16-xx6*a17-xx7*a18-xx8*a19...
-xx9*a20)==2*xx1;
eqn14=-2*(-x3*a0-rr2*a1-rr3*a2-rr2*a3-rr3*a4-rr4*a5-rr5*a6-rr2*a7-rr3*a8-rr4*a9-...
rr5*a10-rr6*a11-rr7*a12-rr2*a13-rr3*a14-rr4*a15-rr5*a16-rr6*a17-rr7*a18-rr8*a19...
-rr9*a20)==2*rr1;
eqn15=-2*(-x4*a0-ww2*a1-ww3*a2-ww2*a3-ww3*a4-ww4*a5-ww5*a6-ww2*a7-ww3*a8-ww4*a9-...
ww5*a10-ww6*a11-ww7*a12-ww2*a13-ww3*a14-ww4*a15-ww5*a16-ww6*a17-ww7*a18-ww8*a19...
-ww9*a20)==2*ww1;
eqn16=-2*(-x5*a0-ee2*a1-ee3*a2-ee2*a3-ee3*a4-ee4*a5-ee5*a6-ee2*a7-ee3*a8-ee4*a9-...
ee5*a10-ee6*a11-ee7*a12-ee2*a13-ee3*a14-ee4*a15-ee5*a16-ee6*a17-ee7*a18-ee8*a19...
-ee9*a20)==2*ee1;
eqn17=-2*(-x6*a0-yy2*a1-yy3*a2-yy2*a3-yy3*a4-yy4*a5-yy5*a6-yy2*a7-yy3*a8-yy4*a9-...
yy5*a10-yy6*a11-yy7*a12-yy2*a13-yy3*a14-yy4*a15-yy5*a16-yy6*a17-yy7*a18-yy8*a19...
-yy9*a20)==2*yy1;
eqn18=-2*(-x7*a0-uu2*a1-uu3*a2-uu2*a3-uu3*a4-uu4*a5-uu5*a6-uu2*a7-uu3*a8-uu4*a9-...
uu5*a10-uu6*a11-uu7*a12-uu2*a13-uu3*a14-uu4*a15-uu5*a16-uu6*a17-uu7*a18-uu8*a19...
-uu9*a20)==2*uu1;
eqn19=-2*(-x8*a0-ii2*a1-ii3*a2-ii2*a3-ii3*a4-ii4*a5-ii5*a6-ii2*a7-ii3*a8-ii4*a9-...
ii5*a10-ii6*a11-ii7*a12-ii2*a13-ii3*a14-ii4*a15-ii5*a16-ii6*a17-ii7*a18-ii8*a19...
-ii9*a20)==2*ii1;
eqn20=-2*(-x9*a0-oo2*a1-oo3*a2-oo2*a3-oo3*a4-oo4*a5-oo5*a6-oo2*a7-oo3*a8-oo4*a9-...
oo5*a10-oo6*a11-oo7*a12-oo2*a13-oo3*a14-oo4*a15-oo5*a16-oo6*a17-oo7*a18-oo8*a19...
-oo9*a20)==2*oo1;
sol = solve(eqn0, eqn1, eqn2, eqn3, eqn4, eqn5, eqn6, eqn7, eqn8,...
eqn9, eqn10, eqn11, eqn12, eqn13, eqn14, eqn15, eqn16, eqn17, eqn18, eqn19, eqn20)
a0sol=double(sol.a0)
a1sol=double(sol.a1)
a2sol=double(sol.a2 )
a3sol=double(sol.a3 )
a4sol=double(sol.a4)
a5sol=double(sol.a5)
a6sol=double(sol.a6)
a7sol=double(sol.a7)
a8sol=double(sol.a8)
a9sol=double(sol.a9 )
a10sol=double(sol.a10 )
a11sol=double(sol.a11)
a12sol=double(sol.a12)
a13sol=double(sol.a13 )
a14sol=double(sol.a14 )
a15sol=double(sol.a15 )
a16sol=double(sol.a16)
a17sol=double(sol.a17)
a18sol=double(sol.a18)
a19sol=double(sol.a19)
a20sol=double(sol.a20)
but I get:- ans = Empty sym: 0-by-1
I'm obviously new to Matlab...any help appreciated..Thanks
  1 个评论
Rik
Rik 2020-8-11
This isn't an answer. Please post it as a comment or a separate question.
Have a read here and here. It will greatly improve your chances of getting an answer.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by