Plotting multi-variable symbolic function assuming variables are constant
20 次查看(过去 30 天)
显示 更早的评论
Hi,
Is it possible to plot a symbolic function that has many different variables assuming you know all of them except for your independent variable are constant?
Also, is it possible to assert things such as the range of one symbolic variable is between 0 and another variable?
An example:
If we wanted to plot something like a ball getting launched in the air and falling, we would have certain initial conditions but the peak of the ball's trajectory could be calculated symbolically. All variables except time would be constant, such as our gravitational acceleration or initial velocity.
Is such a thing possible in MATLAB as a single function?
I'm aware that fplot can do this for less-complex functions.
0 个评论
采纳的回答
Walter Roberson
2019-3-3
Evaluate the symbolic function with constants in the appropriate locations and using a symbolic variable in the position of your independent variable(s). The result will be a symbolic expression, which you can fplot() (one variable) or fsurf() (two variables).
It is possible to, for example,
syms w h positive
assume(w >= 0 & w <= 2*h)
However, if you use vpasolve() then vpasolve() might ignore the constraint. If you use solve() then if solve ends up taking roots then it would typically not check to be sure the roots fit the constraints. So although you can inform MATLAB of the constraint, it will not necessarily pay attention.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!