i want to write code for a question

1 次查看(过去 30 天)
c=0.1(x-y)
x=4:0.01:12
y=sqrt(c/2)
i have to find the value of x for which c=.0038416

采纳的回答

Ameer Hamza
Ameer Hamza 2020-9-27
编辑:Ameer Hamza 2020-9-27
Although this equation is linear is x, and you can write the equation of x. For a general case, you can use fsolve()
c = 0.0038416;
f = @(x) c - 0.1*(x-sqrt(c/2));
x = fsolve(f, 0);
If you have the symbolic toolbox
syms x
c = 0.0038416;
eq = c == 0.1*(x-sqrt(c/2));
x = double(solve(eq))
  2 个评论
Walter Roberson
Walter Roberson 2020-9-27
I think you missed the sqrt() in the symbolic part?
Ameer Hamza
Ameer Hamza 2020-9-27
Thanks for pointing out. OP kept changing the question initially, so I forgot to make the change in the symbolic part.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by