Hi everyone,(adsbygoogle = window.adsbygoogle || []).push({});

I am a matlab newbie and am having some problems getting fsolve to work. I tried using the example given in the help section but it keeps saying that my function (lambda_y1) since that is the first one it finds is unknown.

My functions are generated like this (sorry for the messy notation):

function F = myfun(lambda_y1,lambda_y2,h_1,h_2,F_c1,F_c2)

F = [g_1+607200.*lambda_1.^3-1899000.*lambda_1.^2+1976400.*lambda_1-684600;

g_2+607200.*lambda_2.^3-1899000.*lambda_2.^2+1976400.*lambda_2-684600;

lambda_y1.^2.*(4.*h_m1.^2+y_01.^2)-(4.*(h_m1-h_1).^2+(lambda_1.*y_01).^2);

lambda_y2.^2.*(4.*h_m2.^2+y_02.^2)-(4.*(h_m2+h_2).^2+(lambda_2.*y_02).^2);

F_c1.^2.*(4.*(h_m1-h_1).^2+(lambda_1.*y_01).^2)-16.*g_1^2.*(h_m1 - h_1).^2;

F_c2.^2.*(4.*(h_m2+h_2).^2+(lambda_2.*y_02).^2)-16.*g_2^2.*(h_m2 + h_2).^2];

I call it like this:

x0=[0.5,0.5,0.0005,0.0005,0.1,0.1];

f = fsolve(@myfun,x0,lambda_y1,lambda_y2,h_1,h_2,F_c1,F_c2);

All the constants except for the unknowns are given earlier.

Can anyone help me get this to run?

Lonnie

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab problems with fsolve

**Physics Forums | Science Articles, Homework Help, Discussion**