MatlabForSolvingEqns

MatlabForSolvingEqns - forget the square brackets or the...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
First, boot up Matlab Matlab initial screen looks like this (it may be slightly different.) Assume that you are solving the following simultaneous algebraic equations, 2x 1 – 3x 2 =5 6x 1 + 10x 2 =3 These can be written is a matrix form, Ax = b, where ܣൌቂ 2െ 3 61 0 ቃ,ݔൌ ቂ ݔ ݔ ቃ,ܾܽ݊݀ൌ ቂ 5 3 Type in Matlab Command Window as A=[2 -3; 6 10] Matlab will show what you typed in after you hit the carriage return (see the next screenshot). Don’t
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: forget the square brackets or the semi-colon in the brackets. (You can stop Matlab from repeating your input by adding a semi-colon at the end (i.e., A=[2 -3; 6 10];).) Next, type in b=[5 3] Matlab will repeat it in a similar manner (see below). Dont forget the apostrophe. Then you can solve the x vector (i.e., x 1 and x 2 ) by typing in x=A\b or alternatively, x=inv(A)*b From these, x 1 = 1.5526 and x 2 = -0.6316...
View Full Document

This note was uploaded on 10/16/2011 for the course ENGR 210 taught by Professor Ko during the Fall '08 term at Boise State.

Page1 / 3

MatlabForSolvingEqns - forget the square brackets or the...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online