solving equation

  • Follow


Hi there,

I have the following minor problem; 

I have a function f=x^3 + x - 1 (using x as symbolic value (syms x)) after computing the dirivative using: ff=diff(f,x)

i want to create a for loop x=1:3 and fill in the x in the ff Eguation how can i do this?

thanks in advance!

code:
syms x
f=x^3 + x - 1;
ff=diff(f,x)
for x=1:3
ff(x)
end
0
Reply Paul 12/2/2010 9:44:06 PM

On 10-12-02 03:44 PM, Paul wrote:

> I have the following minor problem;
> I have a function f=x^3 + x - 1 (using x as symbolic value (syms x))
> after computing the dirivative using: ff=diff(f,x)
>
> i want to create a for loop x=1:3 and fill in the x in the ff Eguation
> how can i do this?
>
> thanks in advance!
>
> code:
> syms x
> f=x^3 + x - 1;
> ff=diff(f,x)
> for x=1:3
> ff(x)
> end

Instead of ff(x), you would use

subs(ff)

This would be suitable for displaying the value. If you need to do numeric 
computations on it, then use

double(subs(ff))

0
Reply Walter 12/2/2010 9:49:11 PM


Thanks for your help!
0
Reply Paul 12/2/2010 9:59:09 PM

2 Replies
149 Views

(page loaded in 0.022 seconds)

Similiar Articles:













7/27/2012 9:14:30 AM


Reply: