From: EVDOXIA on
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..
From: Walter Roberson on
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?
From: EVDOXIA on
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?
From: Walter Roberson on
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)...
From: Roger Stafford on
"EVDOXIA " <kangoyras(a)hotmail.com> wrote in message <hsucpp$aq2$1(a)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