FORUM ARCHIVE

 Nav: Similar Threads Thread Thread Starter Forum Replies Last Post Multiple choice exams and midterms !? luxhydrus Academics 4 09-12-2010 06:08 PM Multiple Degrees Goce Academics 9 07-11-2009 09:04 PM Question about multiple choice exams in engineering Oilers Academics 13 05-02-2009 11:14 PM

Help Solving Multiple Equations 02-20-2010 at 11:02 PM #1 ahmedsu Member Join Date: Jul 2009 Posts: 50 Thanked: 1 Time Liked: Liked 3 Times Help Solving Multiple Equations Currently I am working on a heat transfer assignment. I have 10 equations with 10 unknowns (T1 - T10), it is a very tedious method by hand so I thought I would give it a shot in MATLAB, however I am having some trouble. This is the code I formulated: h = 200; k = 300; T0 = 125; Tinf = 25; x = 0.025; A = 0.0004908738521; P = 0.078639816; T1; T2; T3; T4; T5; T6; T7; T8; T9; T10; (h*P*x*(Tinf - T1)) + ((k*A)*((T2-T1)/x)) + ((k*A)*(T0 - T1)) = 0; (h*P*x*(Tinf - T2)) + ((k*A)*((T3-T2)/x)) + ((k*A)*(T1 - T2)) = 0; (h*P*x*(Tinf - T3)) + ((k*A)*((T4-T3)/x)) + ((k*A)*(T2 - T3)) = 0; (h*P*x*(Tinf - T4)) + ((k*A)*((T5-T4)/x)) + ((k*A)*(T3 - T4)) = 0; (h*P*x*(Tinf - T5)) + ((k*A)*((T6-T5)/x)) + ((k*A)*(T4 - T5)) = 0; (h*P*x*(Tinf - T6)) + ((k*A)*((T7-T6)/x)) + ((k*A)*(T5 - T6)) = 0; (h*P*x*(Tinf - T7)) + ((k*A)*((T8-T7)/x)) + ((k*A)*(T6 - T7)) = 0; (h*P*x*(Tinf - T8)) + ((k*A)*((T9-T8)/x)) + ((k*A)*(T7 - T8)) = 0; (h*P*x*(Tinf - T9)) + ((k*A)*((T10-T9)/x)) + ((k*A)*(T8 - T9)) = 0; (h*P*x*(Tinf - T10)) + ((k*A)*((T10-T9)/x)) = 0; T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 The above 10 are my equations (h*P*x*...) however it is given me an error when I say "=0", the error reads "Parse Error: "=" usage might be invalid MATLAB Syntax". I was wondering if anyone could assist me on how to be able to solve for my 10 unknowns, and help me correct my code and write it so that I will be able to solve for my unknowns. Thanks. 02-20-2010 at 11:36 PM #2 stevennn Pro Lurker. Join Date: May 2008 Posts: 115 Thanked: 10 Times Liked: 19 Times I'm not sure if you can do it like that. If you rearrange the equations and make a matrix of the coefficients, you should be able to solve it using Ax=B. __________________ 02-20-2010 at 11:37 PM #3 adrian Elite Member Join Date: Jul 2008 Posts: 593 Thanked: 40 Times Liked: 143 Times Not sure if this will help, but if you formulate your problem in the following manner [coefficient matrix with 10 columns(T1-T10) and n rows, where n is the number of equations] * [column vector with 10 rows(t1-T10)] = [column vector with 10 rows, each 0)] let's say you name the above matrices in the following manner: A*x=b then you can do x = A\b to find x, which is the vector T1-T10 hope it helps somewhat. Adrian Last edited by adrian : 02-20-2010 at 11:40 PM. 02-21-2010 at 12:17 AM #4 adrian Elite Member Join Date: Jul 2008 Posts: 593 Thanked: 40 Times Liked: 143 Times A matrix should look like this(did the algebra for ya): Note: I put nonzero elements of the matrix in brackets for readability MatA= (-h*P*x-k*A/x-k*A) (k*A/x) 0 0 0 0 0 0 0 0 (k*A) (-h*P*x-k*A/x-k*A) (k*A/x) 0 0 0 0 0 0 0 0 (k*A) (-h*P*x-k*A/x-k*A) (k*A/x) 0 0 0 0 0 0 0 0 (k*A) (-h*P*x-k*A/x-k*A) (k*A/x) 0 0 0 0 0 0 0 0 (k*A) (-h*P*x-k*A/x-k*A) (k*A/x) 0 0 0 0 0 0 0 0 (k*A) (-h*P*x-k*A/x-k*A) (k*A/x) 0 0 0 0 0 0 0 0 (k*A) (-h*P*x-k*A/x-k*A) (k*A/x) 0 0 0 0 0 0 0 0 (k*A) (-h*P*x-k*A/x-k*A) (k*A/x) 0 0 0 0 0 0 0 0 (k*A) (-h*P*x-k*A/x-k*A) (k*A/x) 0 0 0 0 0 0 0 0 (-k* A/x) (-h*P*x+k*A/x) please check my algebra Now, there seems to be a constant term for each equation, so we must put it(sign-reversed) in the result column vector so your result column vector should be: resultb = (-h*P*x*Tinf-k*A*T0) (-h*P*x*Tinf) (-h*P*x*Tinf) (-h*P*x*Tinf) (-h*P*x*Tinf) (-h*P*x*Tinf) (-h*P*x*Tinf) (-h*P*x*Tinf) (-h*P*x*Tinf) (-h*P*x*Tinf) Last edited by adrian : 02-21-2010 at 12:35 AM. Reason: Complete 02-21-2010 at 12:25 AM #5 ahmedsu Member Join Date: Jul 2009 Posts: 50 Thanked: 1 Time Liked: Liked 3 Times A = [-27.50893565 5.890486225 0 0 0 0 0 0 0 0; 5.890486225 -27.50893565 5.890486225 0 0 0 0 0 0 0; 0 5.890486225 -27.50893565 5.890486225 0 0 0 0 0 0; 0 0 5.890486225 -27.50893565 5.890486225 0 0 0 0 0; 0 0 0 5.890486225 -27.50893565 5.890486225 0 0 0 0; 0 0 0 0 5.890486225 -27.50893565 5.890486225 0 0 0; 0 0 0 0 0 5.890486225 -27.50893565 5.890486225 0 0; 0 0 0 0 0 0 5.890486225 -27.50893565 5.890486225 0; 0 0 0 0 0 0 0 5.890486225 -27.50893565 5.890486225; 0 0 0 0 0 0 0 0 5.890486225 -21.61844943]; B = [-1129.509858; -393.19908; -393.19908; -393.19908; -393.19908; -393.19908; -393.19908; -393.19908; -393.19908; -393.19908]; v = A\B v = 47.4967 30.0610 26.1386 25.2561 25.0576 25.0130 25.0029 25.0007 25.0001 25.0000 02-21-2010 at 12:37 AM #6 adrian Elite Member Join Date: Jul 2008 Posts: 593 Thanked: 40 Times Liked: 143 Times good stuff 02-21-2010 at 12:21 PM #7 lmasud Senior Member Join Date: Jul 2009 Posts: 241 Thanked: 11 Times Liked: 33 Times you could just use maple, this link explains how to do it __________________ Former McMaster Student Would be Electrical Engineering II 02-21-2010 at 12:25 PM #8 adrian Elite Member Join Date: Jul 2008 Posts: 593 Thanked: 40 Times Liked: 143 Times Hey, we're all grow'd up here. Pfffff....maple....

 Thread Tools Search this Thread Show Printable Version Email this Page Search this Thread: Advanced Search

McMaster University News and Information, Student-run Community, with topics ranging from Student Life, Advice, News, Events, and General Help.
Notice: The views and opinions expressed in this page are strictly those of the student(s) who authored the content. The contents of this page have not been reviewed or approved by McMaster University or the MSU (McMaster Students Union). Being a student-run community, all articles and discussion posts on MacInsiders are unofficial and it is therefore always recommended that you visit the official McMaster website for the most accurate up-to-date information.