"solve" Function
이전 댓글 표시
I'm trying to use the "solve" function to find a variable, but the other variables in the equation are input as opposed to defined. How do I fix this? Here's to illustrate what I'm trying to do using a simplified equation:
x=input('x = ')
y=input('y = ')
z=solve('x+y=z',z)
댓글 수: 2
Tebikew Alemu
2021년 12월 27일
How i can write a matlab cod for a funtion
Example:
syms x
y(x) = sin(x) - x^3/27 %this is the code for the function
fplot(y, [-2*pi 2*pi])
채택된 답변
추가 답변 (2개)
Andrew Newell
2011년 3월 7일
Here is one way:
x=sym(input('x = '))
y=sym(input('y = '))
syms z
z=solve(z-x-y,z)
댓글 수: 5
Patrick Star
2011년 3월 8일
Walter Roberson
2011년 3월 8일
Do you have the symbolic toolbox? What happens if you try
sym('x')
and
sym('1')
?
You do not really need the sym() calls for x and y:
x = input('x = ');
y = input('y = ');
syms z
z = solve(z-x-y,z);
Patrick Star
2011년 3월 8일
Andrew Newell
2011년 3월 8일
Oh. I assumed that you were actually using the command "solve", which is in the Symbolic Toolbox.
Walter Roberson
2011년 3월 8일
Please check to see whether you are licensed for the symbolic toolbox but perhaps have just not installed it. If you happen to be using the Student Edition than this could be the difficulty.
solve() is part of the symbolic toolbox and requires that toolbox be installed and licensed.
카테고리
도움말 센터 및 File Exchange에서 Assumptions에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
