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:
applied maths

Subject: applied maths

From: EVDOXIA

Date: 18 May, 2010 15:47:05

Message: 1 of 5

Hello I am having a little problem!
Basically I need to plot a function of k,y
so this is my script

syms k y
f=100;
h=150;
c1=1450;
c2=1650;
b=1.2;
w=2*pi*f;
a=w*h*sqrt(1/(c1*c1)-1/(c2*c2));
g=sqrt(w/c1*w/c1-k*k);

y=g*h;

tan(y)==(-b*y)/sqrt(a*a-y*y)

plot(k,y);

However the first problem was the equation of " tan(y)==(-b*y)/sqrt(a*a-y*y)"
So i turned it into "=="
The problem was solved i guess but then it did not run the plot and as an output it sasy this" ??? Error using ==> plot
Conversion to double from sym is not possible."
Thus I am aksing you if you could tell me what could i change.
Not to forget tha for my syms I want them to be variables that take values from -infinite to +infinite.

Thank you so much..

Subject: applied maths

From: Walter Roberson

Date: 18 May, 2010 16:00:43

Message: 2 of 5

EVDOXIA wrote:

> Not to forget tha for my syms I want them to be variables that take
> values from -infinite to +infinite.

Ummm, it takes an infinite amount of time to plot over an infinite range.

By the way, consider using subs()

 > tan(y)==(-b*y)/sqrt(a*a-y*y)

I am having trouble figuring out what you want to do with that line. Is
it intended to be an identity? A constraint? Are you trying to solve for
the values of y that satisfy that?

Subject: applied maths

From: EVDOXIA

Date: 18 May, 2010 16:08:04

Message: 3 of 5

Actually I want to plot it first so that i can see how it goes and then solve it with method of newton.But I know how to continue it if i can see the plot.I know how to make the code for newtons method.
Was this helpfull?

Subject: applied maths

From: Walter Roberson

Date: 18 May, 2010 16:24:44

Message: 4 of 5

EVDOXIA wrote:
> Actually I want to plot it first so that i can see how it goes and then
> solve it with method of newton.But I know how to continue it if i can
> see the plot.I know how to make the code for newtons method.
> Was this helpfull?

No matter what you do, you will not be able to plot over an infinite
range, not in a finite amount of time. If you want to plot, you will
have to use a finite range and a finite number of points within that
range. For this purpose, I suggest you choose a range, use linspace() to
create a set of points over the range, and subs() that into your
symbolic expression in order to get a vector of numeric values that can
then be plotted. You may have to use double() in order to convert
symbolic numbers into binary numbers.

And I still don't understand about tan(y)...

Subject: applied maths

From: Roger Stafford

Date: 18 May, 2010 19:57:04

Message: 5 of 5

"EVDOXIA " <kangoyras@hotmail.com> wrote in message <hsucpp$aq2$1@fred.mathworks.com>...
> Hello I am having a little problem!
> Basically I need to plot a function of k,y
> so this is my script
>
> syms k y
> f=100;
> h=150;
> c1=1450;
> c2=1650;
> b=1.2;
> w=2*pi*f;
> a=w*h*sqrt(1/(c1*c1)-1/(c2*c2));
> g=sqrt(w/c1*w/c1-k*k);
>
> y=g*h;
>
> tan(y)==(-b*y)/sqrt(a*a-y*y)
>
> plot(k,y);
>
> However the first problem was the equation of " tan(y)==(-b*y)/sqrt(a*a-y*y)"
> So i turned it into "=="
> The problem was solved i guess but then it did not run the plot and as an output it sasy this" ??? Error using ==> plot
> Conversion to double from sym is not possible."
> Thus I am aksing you if you could tell me what could i change.
> Not to forget tha for my syms I want them to be variables that take values from -infinite to +infinite.
>
> Thank you so much..

  It is not at all clear what you are trying to do. With the values you have given a and b, the equation

 tan(y)=(-b*y)/sqrt(a*a-y*y)

has only the solution y = 0. The corresponding k would have only two possible values. How is it you expect anything significant in the plot of y against k under those circumstances?

Roger Stafford

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