Plotting multi-variable symbolic function assuming variables are constant
조회 수: 19 (최근 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!