|
"Chris McCorquodale" wrote in message <iev2lg$s4r$1@fred.mathworks.com>...
> > doc fzero
>
> Hi, Thanks for pointing me in the right direction. I am struggling to get it to work though...in the doc it says:
>
> % function f = myfun(x,c)
> % f = cos(c*x);
>
> so I write:
>
> but when I try anything like that it comes up with "??? function f=myfun(x,d) Error: Function definitions are not permitted in this context."
> Any ideas?
> If I can get past this, would I define my function as:
>
> function f = myfun(N,x,y,z,b,c)
> f = y*N^b +z*N^c -x ?
>
> where N is the only unknown?
>
> Thanks,
Hi ignore that last bit, I have figured it out by doing:
N=fzero(@(N) Y*(N).^b + Z*(N).^c - X,300);
It would appear that this function will only work for one individual value,however. Is there any way to compute it for the coefficients of a matrix?
The matrix i have is size 3116x1 so dont fancy typing each one individually!
Thanks,
|