COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### 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?

code:
syms x
f=x^3 + x - 1;
ff=diff(f,x)
for x=1:3
ff(x)
end
```
 0

```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?
>
>
> 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

```Thanks for your help!
```
 0

2 Replies
149 Views

Similiar Articles:

7/27/2012 9:14:30 AM