How to use three- line loop with disp to find derivative
显示 更早的评论
I want to find the first five derivatives of f(x)=x((2x+1)^1/2), Using the three-line for loop wih disp.
采纳的回答
更多回答(2 个)
Jan
2012-2-13
0 个投票
You cannot find the derivative using a FOR-loop. As far as I can see, you only can use forward, backward or central differences to calculate an approximation of the derivative.
It is not clear what a "three-line for loop" is any what "with disp" exactly mean. It seems like you got a strange homework assignment.
G A
2012-2-14
0 个投票
syms y x
y=x*(2*x+1)^(1/2);
f{1}=diff(y,x);
for n=2:5, f{n}=diff(f{n-1},x);end
f{:} %is this what you mean disp?
2 个评论
Dhurgham Kadhim
2012-2-14
G A
2012-2-14
strange... you can just copy this code to the matlab window and press 'enter'. Do not forget f{:}
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!