solving and ploting a system of nonlinear equations

hi everyone,
im trying to solve and plot a system of 2 nonlinear equations but for some reason i cant get matlab to give me the right answer.
this is what i have so far:
function solveeqs()
guess=[6 5];
result=fsolve(@eqns,guess);
result
end
function fcns=eqns(z)
x=z(1);
y=z(2);
fcns(1)=cos(x)-log(y)+1.3258;
fcns(2)=sin(y)-tan(x)-2.4216;
end
matlab tells me that the answer is (5,5.0001) but thats not true.
ive also tried to plot the equations but with no success, also if i plot the graphs in desmos i get completely different results.
im really a begginer in matlab so any help would be greatly appreciated
thanks!

1 Comment

Note that the arguments of cos, sin and tan are assumed as given in rad, not in degrees. The solution you get from fsolve satisfies your equations. What makes you think it is not correct ?

Sign in to comment.

Answers (0)

Categories

Asked:

on 2 Jun 2018

Edited:

on 4 Jun 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!