Solve Lagrange multiplier equations in MATLAB

  • Permalink
  • submit to reddit
  • Email
  • Follow


I would like to solve first simple example on
http://en.wikipedia.org/wiki/Lagrange_multipliers
 in MATLAB, any idea how to input it in MATLAB using built in
optimization routines.
0
Reply faisalmufti (169) 1/25/2009 7:32:15 AM

See related articles to this posting


fas <faisalmufti@gmail.com> wrote in message <53904571-a932-4f62-af98-13e35cda25a1@p2g2000prf.googlegroups.com>...
> I would like to solve first simple example on
> http://en.wikipedia.org/wiki/Lagrange_multipliers
>  in MATLAB, any idea how to input it in MATLAB using built in
> optimization routines.

help fmincon

Bruno
0
Reply b.luong5955 (6403) 1/25/2009 8:07:08 AM

On Jan 25, 8:07=A0pm, "Bruno Luong" <b.lu...@fogale.findmycountry>
wrote:
> fas <faisalmu...@gmail.com> wrote in message <53904571-a932-4f62-af98-13e=
35cda2...@p2g2000prf.googlegroups.com>...
> > I would like to solve first simple example on
> >http://en.wikipedia.org/wiki/Lagrange_multipliers
> > =A0in MATLAB, any idea how to input it in MATLAB using built in
> > optimization routines.
>
> help fmincon
>
> Bruno

Could you please help a little further by putting it all together.
Also isn't fmincon for constraints with upper and lower bounds ?. In
this case we only x^2+y^2-1=3D0 constraint. Also what about fsolve ?
Thanks,
0
Reply faisalmufti (169) 1/25/2009 11:40:55 PM

fas <faisalmufti@gmail.com> wrote in message <744606c0-2bf4-4fb4-8812-f65bf841b39f@w1g2000prk.googlegroups.com>...

> 
> Could you please help a little further by putting it all together.

I could, but I risk not doing as well as the doc.

> Also isn't fmincon for constraints with upper and lower bounds ?. 

Yes, optionally. Just give don't use it if you don't need it

>In
> this case we only x^2+y^2-1=3D0 constraint. 

Look at 9th parameter (nonlcon). 

I recommend reading the doc. All is there.

Bruno
0
Reply b.luong5955 (6403) 1/26/2009 6:41:12 AM
comp.soft-sys.matlab 203514 articles. 531 followers. Post

3 Replies
327 Views

Similar Articles

[PageSpeed] 40


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

How to solve simulate/ solve difference equation in Matlab?
How can I simulate or solve this kind of difference equation? x(k+2)-7x(k+1)+12x(k)=0 A for loop would work nicely. This particular system is unstable. -James Tama Tomi wrote: > How can I simulate or solve this kind of difference equation? > > x(k+2)-7x(k+1)+12x(k)=0 Can you give me a example? James Allison <james.allison@mathworks.com> wrote in message <hmr9fp$62s$1@fred.mathworks.com>... > A for loop would work nicely. This particular system is unstable. > > -James > > Tama Tomi wrote: > > How can I simulate or solve this kind of...

Can Matlab solve a system of equations contain one pde(1-D) equation and 3 ode equations by the pdepe solver?
I have a system of equations contains one one-dimensional pde and three ode. Can it be solved by the 'pdepe' solver? If it can,how do I treat the boundary function of odes? ...

Matlab program to solve wave equation up to linear system of equations
New in matlab, Need help please in making a matlab program to solve the wave equation below up to the point when you obtain a system of equations. solve the wave equation below up to the system of equation using Finite difference method utt = c^2 uxx, ut(x,0) = 3sin((pi x)/9) , u(x,0) = 0, U(0,t) = U(4,t) = 0, hx = 1, ht = 0.5, c = 2, nx = 4, nt = 2 nx, hx are number and size of x panels nt, ht are number and size of t panels I am using the Finite difference scheme below u(i,j+1) = c^2*(ht/hx)^2 *(u(i+1,j) + u(i-1,j)) - u(i,j-1) + 2*(1 - c^2*(ht/hx)^2 )*u(i,j) "Kayanja Andy...

Solving Coupled Equations of the form Nonlinear Schrodinger Equation using Matlab
I'm doing a fourth year project...Im just starting out and was wondering if anyone would have any suggestions on where to start for this topic.... Melissa wrote: > > > I'm doing a fourth year project...Im just starting out and was > wondering if anyone would have any suggestions on where to start > for > this topic.... Hi GP Agrawal 's book on NL fiber is good start.. Dr. Abhay Kumar > > 4 years? I had to solve this problem in 6 months.... (NLSE + a constitutive equation which correlates the optical field to another physical quantity present i...

solving an equation in matlab
Hi, I wanted to know if there were any inbuilt commands in matlab to solve the equation of the form f(x)=0 numerically. The function f(x) is composed of user written functions. I would really appreciate any help of this as I need it for some urgent work. Thanks. In article <ef26062.-1@webx.raydaftYaTP>, "Apoorva Shende" <apoorvashende@indiatimes.com> wrote: > Hi, I wanted to know if there were any inbuilt commands in matlab to > solve the equation of the form f(x)=0 numerically. The function f(x) > is composed of user written functions. I would really apprecia...

how to solve equations with matlab
Hi guys I want to solve this kind of equation: a*x + b*y = A (1) a1*x^2 + b1*y^2 = B (2) Thanks in advanced Zhong zhang skrev 2010-01-02 02:17: > Hi guys > > I want to solve this kind of equation: > > a*x + b*y = A (1) > a1*x^2 + b1*y^2 = B (2) > > Thanks in advanced > > Zhong See for example: http://www.mathworks.com/support/solutions/en/data/1-15NRJ/index.html On Jan 1, 8:17=A0pm, "zhang " <xiao...@gmail.com> wrote: > Hi guys > > I want to solve this kind of equation: > > a*x + b...

how solving equation by matlab
hi how can i use matlab to solve equations with my best wishs mido wrote: > hi > how can i use matlab to solve equations > with my best wishs This question needs to be refined a bit. Do you want to solve simultaneous systmes of linear equations? Do you want to solve differential equations? Do you want solve an equations by finding the zeros? Those are just the first few possibilities that come to mind. If I spent a little more time, I'm sure I could come up with another half-dozen (or more) possibilities. That said, I would *strongly* urge you to read the "Getting ...

Solving simultaneous equations in matlab
Hi, I am trying to solve simulataneous equations to create a curve by plugging in the variables a and b into the equation Sscaled = a*Sraw + b; HT = [32.9 32.4 34.8 35.6]; LT = [19.8 26.6 29.5 30.3]; The equations to solve a and b is a = - (b/LT); b= 1/((HT*(a))+b; How can I solve the equations with two unknowns simultanously to plug into the Sscaled = a*Sraw +b; Thank you On Nov 19, 4:42=A0pm, "Yvonne " <h...@waikato.ac.nz> wrote: > Hi, > > I am trying to solve simulataneous equations to create a curve by pluggin= g in the variables a and b in...

solving differential equation
Hi, I need some help with this problem: Equation: A(d^2 U)/(dx^2 )+BU+CG(x,y)=0 Parameters: A,B,C - known scalars, U(x,y) is a function (2D matrix), G(x,y) is a known 2D matrix. Surface: rectangle: x axis: [0,300]. y axis: [0,1000]. Boundary conditions: Side 1 (x=0): dU/dx=0. Side 2 (y=1000) and side 4 (y=0): U(x,0)=U(x,1000). Side 3 (x=300): U(300,y)=0. I can solve this equation analytically, but I would like to solve it with the finite elements method in order to be able to do it on different surfaces. Thanks, Yossi > Hi, > > I need some help with this problem: > Equation:...

Solving 3 equations in Matlab
Hello, I`m having trouble solving equations simultaneously in Matlab. I have three equations and three unknowns. Two equations are algebraic and one is a differential equation. Here are my three equations, any help would be appreciated: 1. (0.3*1.06*3348*Ttank)-(0.3*1.06*3348*Toutc)+(20*200*(sin(t/24*3.14))^8=0 2. (0.041*4418*20)-Toutw*4418*0.041+1000*((Ttank-20)-(Ttank-Toutw))/ln(Ttank-20)/(Ttank-Toutw) 3. 1.06*3348*1.5* dTtank/dt=0.03*1.06*3348*Toutc-0.03*1.06*3348*Ttank-1000*((Ttank-20)-(Ttank-Toutw))/ln(Ttank-20)/(Ttank-Toutw) t is time and will simulate from 0 until 300. Intia...

how to solve implicit equations in matlab
please anyone tell me how to solve following implicit equation in matlab, y tan(x)+ sqrt(65.25^2-y^2) -99=0 where x is known and is an array from 0 to 85 deg Amit Bhetiwal <drdo.amitbhetiwal@gmail.com> wrote in message <65b2861a-d889-421f-99ca-f0d9caf59c2e@a28g2000prb.googlegroups.com>... > please anyone tell me how to solve following implicit equation in > matlab, > > y tan(x)+ sqrt(65.25^2-y^2) -99=0 > where x is known and is an array from 0 to 85 deg The simple answer is fzero, coupled with a for loop. Or, with just a wee bit of algebraic mani...

equations system solving with matlab
Hi everyone. I have solved my last problem but I have a new one. I try to solve a system of differential equations. After writing it down and run it I write on the command window the following: [z,y]=ode45(@sistema1,[0 2],[0 1 20 175.5 5.304 0.08 0.221]) My problem is that even though I write this initial values, matlab takes zero for the initial value of all the variables. Thank you for your help. ...

solving equations in matlab simulnik
Hi, In my current work, I have to calculate the intersection point of a fixed curve and a moving straight line (the line always cross a robot center point(a,b)) in matlab simulink. I tried some ways and failed: Using matlab simulink->user-defined function->embedded matlab function: code#1: ----------------------------------------- function [f,g] = test2(a,b) syms x y [f,g]=solve(2*x^3+x*(1-2*b)-a,x^2-y); ------------------------------------------- produces an error: "Command-duality is not supported". Many people say b/c simulink does not support Symbolic Math To...

solving implicit equations with matlab?
Hi guys Does somebody have an elegant idea to solve an implicit equation (like y=exp(y)-3) numerically with matlab? Are there any built in functions or do I have to program it by myself? Appreciated Eva Eva Greens wrote: > Does somebody have an elegant idea to solve an implicit equation (like y=exp(y)-3) numerically with matlab? Are there any built in functions or do I have to program it by myself? one of the VERY MANY solutions: you could use the <symbolic tbx>, eg, res=solve('y=exp(y)-3') % res = % [ -lambertw(-exp(-3))-3] % [ -lambertw(-1,-exp(-3))-3] % f...

Solving 4 equations in MAtlab
Hi there I have the following 3 equations: y1 = a1 + (a2*t^2)/(1+ a3*t +a4*t^2) y2 = a2*t*(2+a3*t)/(1+ a3*t +a4*t^2)^2 y3 = -2*a2*(-1+3*a4*t^2 + a3*a4*t^2)/(1+ a3*t +a4*t^2)^3 I have the following values: y1(33) = 1.025031777 y2(33) = 0.02973 y3(33) = -0.001465 y1(1000) = 1.8 How do I solve this system in Matlab to obtain a1,a2, a3 and a4? Cheers "Ashwath Sundaresan" <asu33@student.canterbury.ac.nz> wrote in message <g1vj5a$gco$1@fred.mathworks.com>... > Hi there > > I have the following 3 equations: > > y1 = a1 + (a2*t...

solving equations system with Matlab
I want to solve an equations system such as: dP/dz=4*x*s x=2*P s=5*x If I create the system: dy(1)=4*y(2)*y(3); y(2)=2*y(1); y(3)=5*y(2); in an M-file and the try to solve it using for example ode45,Matlab solves it, but taking y(2) and y(3) as constants. How must I write the system in order to make it understand that they change? Thank you for your help. Reyes Alvarez wrote: > > > I want to solve an equations system such as: > > dP/dz=4*x*s > x=2*P > s=5*x > > If I create the system: > > dy(1)=4*y(2)*y(3); > y(2)=2*y(1); > y(3)=5*y...

Solving Transcendental Equations in Matlab
Hi How do i solve transcendental equations in matlab. Is there built in function or do i have to write a code involving numerical techniques. I want to solve for M M=12.56/(6.28+(1/2M)+acos(sqrt(1-(1/M)^2))+M(1+sqrt(1-(1/M)^2))) Is there any text book for solving nonlinear equations in matlab Torsten Hennig <Torsten.Hennig@umsicht.fhg.de> wrote in message <28893072.11620.1245668013964.JavaMail.jakarta@nitrogen.mathforum.org>... > > Hi > > How do i solve transcendental equations in matlab. Is > > there built in function or do i have to write a code > > inv...

how to solve this ode equation in matlab
Hi all, I need to solve a system of higher order Ordinary Differential Equations in matlab,plz help me out,i cant find the tutorials for solving them.The equations are as follows 2X??+10X?+150X-5Y?-100Y=20Sin5t 3Y??+8Y?+120Y-5X?-100X=50Cos10t it will be really helpful if you guys can solve the equations Regards, Krish "phanikrishna kalapala" <krishna.kalapala@gmail.com> wrote in message news:gd048t$i3i$1@fred.mathworks.com... > Hi all, > I need to solve a system of higher order Ordinary Differential Equations > in matlab,plz help me out,i cant find the tutorials...

how to solve this integral equation in Matlab?
Integrate(some_function_of_(t), t from 0 to x) == constant. Now I to find the solution x to the above integral function. How to do this in Matlab? thanks a lot! In article <e9egvr$kq1$1@news.Stanford.EDU>, "Michael" <michael.monkey.in.the.jungle@gmail.com> wrote: > Integrate(some_function_of_(t), t from 0 to x) == constant. > > Now I to find the solution x to the above integral function. > > How to do this in Matlab? > > thanks a lot! ---------------------- If your integral has no convenient closed-form solution, why don't you try ...

solving Differential Equations in matlab
I have following Differential Equations a1*x2+b2*x1-c*cos(int(x3))*x4=d -c*cos(int(x3))*x2-a2*sin(int(x3))+b2*x4=0 where a1,b2,c,d,a2,b2 are constants and x1=theta_dot; x2=theta_ddot; x3=alpha_dot; x4=alpha_ddot I want to solve these equations for x1,x2,x3,x4 and want to plot with time. On 12 Okt., 09:23, "Vijay Marathe" <vijay_marath...@yahoo.co.in> wrote: > I have following Differential Equations > > a1*x2+b2*x1-c*cos(int(x3))*x4=d > -c*cos(int(x3))*x2-a2*sin(int(x3))+b2*x4=0 > > where a1,b2,c,d,a2,b2 are constants and x1=theta_dot; x2=theta_ddo...

Newbie on Matlab
Dear All, I am a new user to MATLAB and trying this out. I have an equation defined as Vi that i need to solve for various values of V. How do I write this out in MATLAB for the program to find the solutions for me? TIA. Vi = V - Rs * (-(((Jsc * Suns - Vi/Rp)*Aactive)/(1- exp (Be (-sqrt(junc - Vb )/(junc - Vi ))))) + (Jo1 * Aactive * (exp(Vi/Vt)-1)) + (ID2 = Jo2 * Aactive * (exp(Vi/2*Vt)-1)))/Aactive where V range from -0.7 to 0.7 "alvin wee" wrote in message <jl6ge7$edm$1@newscl01ah.mathworks.com>... > Dear All, > I am a new user to MATLAB and trying thi...

Solve Binary Equations in Matlab
Hi, I have a system of linear equations (binary equations) that I need to solve. I am wondering if matlab can solve binary equations. (I am not concerned about efficiency - I just want my job done, at the end of the day.) Anyway if matlab cannot deal with binary equations, can it convert elements of a matrix to integers i.e. by multiplying each of them with the inervse of the least non-zero element. (I am not sure what is this called mathematically.) I am not sure if my explanation is clear - so I provide an example. (I am sorry I could not find a small example - I could not get this to re...

solving differential equation in matlab
write a program in matlab to show the variation of time constant with change in the capacitance of a series RC circuit(first order).value of R can be anything.input is C and outpur is time constant.also plot voltage across capacitance vs time. avnish gaurav <avnish.gaurav@gmail.com> wrote in message <333925.1226579922939.JavaMail.jakarta@nitrogen.mathforum.org>... > write a program in matlab to show the variation of time constant with change in the capacitance of a series RC circuit(first order).value of R can be anything.input is C and outpur is time constant.also plot voltage...

solve quadratic equation in matlab
Hi. Can I solve this quadratic equation in Matlab? If so, how? (A - X)*B*(A - X)' = 1 A = [a1 a2 a3] and B is a 3x3-matrix. A and B are known. And X = [x x x] is unknown. Thank you "Cecilia " <ceciliaf@stud.ntnu.no> wrote in message <lran5e$db1$1@newscl01ah.mathworks.com>... > Hi. > Can I solve this quadratic equation in Matlab? If so, how? > (A - X)*B*(A - X)' = 1 > > A = [a1 a2 a3] and B is a 3x3-matrix. A and B are known. And X = [x x x] is unknown. There are infinity solutions. Fors example if A = [0 0 0] and B = eye(3), any...