



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Engineering 0012: Introduction to Engineering Computing Fall Term, 2003 (04-1)
x = 3; while (x < 8) disp('Am I done yet?') x = x + 2.5; end
function [out] = examfcn(in)
Engineering 0012: Introduction to Engineering Computing Fall Term, 2003 (04-1)
Answer: loglog(x,y,โr*โ)
Answer: coeff = polyfit(log(x),log(y),1)
coeff = polyfit(x,log10(y),1)
coeff = 3 2
Answer: log 10 (y) = 3x+
Answer: y = 10 (3x+2) = 100( 3x )
Engineering 0012: Introduction to Engineering Computing Fall Term, 2003 (04-1)
Answer: xzero = fzero(fcn_name,1.5)
Answer: xmin = fminbnd(fcn_name,-1,1.5)
Answer: xzero = fzero(fcn_name,1.5)
Answer: xmin = fminbnd(fcn_name,-1,1.5)
Answer: xzero = fzero(fcn_name,1.5)
Engineering 0012: Introduction to Engineering Computing Fall Term, 2003 (04-1)
% script (^) Display
Display 1 x = 4 2 y = 3 3 out2 = 0 0 0 0 0 4 out1 = 12 (^5) out1 = 8 6 back 1 = 12 0 0 8 0 7 out1 = 7 8 back2 = 7 9 done 10 11 12 13 14 15 x = 4 y = 3 z = [2 4 5 3 1]; for i = 1:2: if (i <= 2) back1 = fcn1(i,x,y,z) elseif (i > 3) disp('done') else back2 = fcn2(i,y,x,z) end end function [out2] = fcn1 (j,y,x,k) out2 = [0 0 0 0 0] for i=1:3: out2(i) = fcn2(i,x,y,k); end function [out1] = fcn2 (j,d,s,k) switch (k(j)) case {1,2} out1 = d+ case {3,4} out1 = 2*s otherwise out1 = d+s end
Engineering 0012: Introduction to Engineering Computing Fall Term, 2003 (04-1)
Error in ==> C:\temp\eqnsolver.m On line 14 ==> rhs = augmat(:,Ncol); (1) Offending line of code, Line #: 12 (2) Correction: [Nrow, Ncol] = size(augmat);
Matrix dimensions must agree. Error in ==> C:\temp\eqnsolver.m On line 17 ==> soln = Amat/rhs; (1) Offending line of code, Line #: 17 (2) Correction: soln = Amat\rhs; soln = inv(Amat)rhs; soln = (Amat^(-1))rhs;
")" expected, "identifier" found. (1) Offending line of code, Line #: 21 (2) Correction: disp('The solution vector is')
script to solve linear set of equations A*x = b requires augmented coefficient matrix file