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:
one problem with symbol

Subject: one problem with symbol

From: Yi

Date: 7 Mar, 2008 17:38:03

Message: 1 of 3

>>clear all; clc;
>>syms x1 x2 x3
>>y=x1+x2^2+x3^3;
>>x1=1;x2=2;

Then I want to get y=5+x3

but when I type y
matlab still give me

>>y
y=
   x1+x2^2+x3^3;

Could anybody tell me how to get y=5+x3 when I type y?

Subject: one problem with symbol

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 7 Mar, 2008 17:48:00

Message: 2 of 3

In article <fqruhr$9b5$1@fred.mathworks.com>, Yi <hvachy@163.com> wrote:
>>>clear all; clc;
>>>syms x1 x2 x3
>>>y=x1+x2^2+x3^3;
>>>x1=1;x2=2;

>Then I want to get y=5+x3

>but when I type y
>matlab still give me

>>>y
>y=
> x1+x2^2+x3^3;

>Could anybody tell me how to get y=5+x3 when I type y?

newy = subs(y,{'x1','x2'},{1,2});
--
'Roberson' is my family name; my given name is 'Walter'.

Subject: one problem with symbol

From: Yi

Date: 7 Mar, 2008 19:10:20

Message: 3 of 3

Thank you!

Tags for this Thread

No tags are associated with 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