use of vairibles with solve
2 次查看(过去 30 天)
显示 更早的评论
hi, im fairly inexperienced in matlab so any help would be useful here basically i ave simple bit of code and i need to solve an equation for x where in the equation another preassigned variable is used
solve ('cos(x/b) + sin(x/b) - 0.7==x')
here 'b' should be a constant that's already been assigned earlier
also i'm having trouble getting answers from 'solve' to be stored in a variable. any help would be greatly appreciated.
0 个评论
采纳的回答
David Sanchez
2013-12-13
The following code should not give you any trouble:
syms x
b = 3; % use your own value here
my_answer = solve (cos(x/b) + sin(x/b) - 0.7==x);
It yields:
my_answer =
0.43360539229972390998442935562107
2 个评论
Walter Roberson
2013-12-13
Note: this syntax will not work until about R2011b (I think it was). For earlier versions, change the "==x" to "-x"
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Equation Solving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!