Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

solving nonlinear equations system

Status
Not open for further replies.

mountainman

Mechanical
Jan 5, 2003
4
I've been trying the following code to find the solutions of a two-equation system.

>syms x y
>
>eq1='(x-Xg)^2+(y-Yg)^2=102.9^2'
>eq2='((x-Xd(i))^2+(y-Yd(i))^2)^(1/2)=rod'
>
>
>S=solve(eq1,eq2)

Where Xg and Yg are declared variables and Xd and Yd are vectors. I want to use the solve in a loop so I need to be able to change the Xd and Yd values, hence the use of vectors and (i). The problem is that when I test the code with constant values instead of variables it works like a charm, and when I use it like you see it doesn't use the declared variables' values.

Is it possible to use this code or I'm using the wrong method??

Thanks for the answers!
 
Replies continue below

Recommended for you

try this
Code:
>syms x y
>
>eq1=['(x-' num2str(Xg) ')^2+(y-' num2str(Yg) ')^2=102.9^2']
>eq2=['((x-' num2str(Xd(i)) ')^2+(y-' num2str(Yd(i)) ')^2)^(1/2)=rod']
>
>
>S=solve(eq1,eq2)
M
 
Thanks a lot MikeyP!

Do you know a good ressource (biiks, websites...) to get better in Matlab??

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor