Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Change symbols back to numbers

Subject: Change symbols back to numbers

From: Sheida

Date: 21 Oct, 2010 20:31:05

Message: 1 of 2

Hi I am trying to solve an equation (to eventually put in a loop). However, after I take care of the differentiating, I cannot replace the symbols with actual numbers. Could someone please help me?
Here is what my m file looks like:
syms u1 u2
f = [(u1^3) - u2; (u2^3) - u1];
u = [u1;u2];
J = jacobian(f,u);
Ji = inv(J);
b = Ji*f;
 u1 = 2;
 u2 = 1;
    u = u - b

my result for "u" is:
u =
 
 u1 + (u1 - u2^3)/(9*u1^2*u2^2 - 1) + (3*u2^2*(u2 - u1^3))/(9*u1^2*u2^2 - 1)
 u2 + (u2 - u1^3)/(9*u1^2*u2^2 - 1) + (3*u1^2*(u1 - u2^3))/(9*u1^2*u2^2 - 1)

I want matlab to replace all u1s with 2 and all u2s with 1. I have been searching for the past couple of hours and have not found anything. It doesn't seem like it is too hard but I just cant figure it out!
Thanks!

Subject: Change symbols back to numbers

From: Steven_Lord

Date: 21 Oct, 2010 21:01:35

Message: 2 of 2



"Sheida " <s.d.not.this@gmail.com> wrote in message
news:i9q7u9$m8h$1@fred.mathworks.com...
> Hi I am trying to solve an equation (to eventually put in a loop).
> However, after I take care of the differentiating, I cannot replace the
> symbols with actual numbers. Could someone please help me? Here is what my
> m file looks like: syms u1 u2
> f = [(u1^3) - u2; (u2^3) - u1];
> u = [u1;u2];
> J = jacobian(f,u);
> Ji = inv(J);
> b = Ji*f;
> u1 = 2;
> u2 = 1;
> u = u - b
>
> my result for "u" is:
> u =
>
> u1 + (u1 - u2^3)/(9*u1^2*u2^2 - 1) + (3*u2^2*(u2 - u1^3))/(9*u1^2*u2^2 -
> 1)
> u2 + (u2 - u1^3)/(9*u1^2*u2^2 - 1) + (3*u1^2*(u1 - u2^3))/(9*u1^2*u2^2 -
> 1)
>
> I want matlab to replace all u1s with 2 and all u2s with 1. I have been
> searching for the past couple of hours and have not found anything. It
> doesn't seem like it is too hard but I just cant figure it out! Thanks!

HELP SUBS.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us