expressing a matlab statement

View: New views
5 Messages — Rating Filter:   Alert me  

expressing a matlab statement

by Dr Preyesh T. Goven Shiba :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi
 
I'm a beginner with the use of matlab and octave... Can someone please help me....How do i express the function y as a amtlab statement for the following expression
 
 
y^2 - 2y = x + 1
 
Thankx
Preyesh
 

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: expressing a matlab statement

by dastew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dr Preyesh T. Goven Shiba wrote:

> Hi
>  
> I'm a beginner with the use of matlab and octave... Can someone please
> help me....How do i express the function y as a amtlab statement for
> the following expression
>  
>  
> y^2 - 2y = x + 1
>  
> Thankx
> Preyesh
>  
> Email: drgovenshiba@... <mailto:drgovenshiba@...>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Help-octave mailing list
> Help-octave@...
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>  
I assume that x is the independent variable.
This is a quadratic in y , therefore there are two solutions  for y
y^2 -2y -x-1=0
y= (-b +- sqrt(b^2 -4ac)) /2a      the generic solution.


y1=(2+sqrt(4-4*(-x-1)))/2
or y1=1+sqrt(2+x)
and y2=1-sqrt(2+x)

hope this helps.


 
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: expressing a matlab statement

by Rolf Fabian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Dr Preyesh T. Goven Shiba wrote:
Hi

I'm a beginner with the use of matlab and octave... Can someone please help me....How do i express the function y as a amtlab statement for the following expression


y^2 - 2y = x + 1

Thankx
Preyesh

Email: drgovenshiba@vodamail.co.za
First, solve the quadratic equation in varible y
"y^2 - 2*y -(x+1) = 0"
using standard school math
and you'll get
y = ... (you should do it by yourself!)

Then, at the Octave prompt, type:
:> function y = myfunc(x) y = .... (your result from above); endfunction

afterwards, you're able to type e.g


Rolf Fabian
<r dot fabian at jacobs-university dot de>

Re: expressing a matlab statement

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Mar 6, 2008, at 4:47 AM, Dr Preyesh T. Goven Shiba wrote:

> Hi
>
> I'm a beginner with the use of matlab and octave... Can someone  
> please help me....How do i express the function y as a amtlab  
> statement for the following expression
>
>
> y^2 - 2y = x + 1
>
> Thankx
> Preyesh

Matlab/Octave are computational applications. Assuming I got the  
algebra correct,

y1 = 1 + sqrt(1 + 4*(1+x));
y2 = 1 - sqrt(1 + 4*(1+x));
y = union(y1,y2);

If  you're looking for a program that will provide a symbolic solution  
(i.e. start with y^2-2y=x+1 and provide an equation representing y),  
take a look at Maxima.

http://maxima.sourceforge.net/

Ben


_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: expressing a matlab statement

by Rolf Fabian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ben Abbott wrote:
Matlab/Octave are computational applications. Assuming I got the  
algebra correct,

y1 = 1 + sqrt(1 + 4*(1+x));
y2 = 1 - sqrt(1 + 4*(1+x));
y = union(y1,y2);

If  you're looking for a program that will provide a symbolic solution  
(i.e. start with y^2-2y=x+1 and provide an equation representing y),  
take a look at Maxima.

http://maxima.sourceforge.net/

Ben
Ben

IMHO and also from a pedagogical point of view the worst thing to do
is to provide beginners with all-embracing answers.

Fortunately your presented result is that far off from the algebraical
correct result that the questioner still has the chance to improve
his/her calculational skills by solving it alone.

rf

Rolf Fabian
<r dot fabian at jacobs-university dot de>