Matlab Review
Picker Engineering Program Smith College EGR 301
January 25, 2005 Judith Cardell
- Basic commands
- Running script files and capturing output
- Matrix manipulations
- Plotting
Matlab Review Picker Engineering Program Smith College EGR 301 - - PDF document
Matlab Review Picker Engineering Program Smith College EGR 301 January 25, 2005 Judith Cardell Basic commands Running script files and capturing output Matrix manipulations Plotting Matlab Hints Matlab is available on
January 25, 2005 Judith Cardell
% % MatlabSample1.m % Your name, date ... % % Problem number 3.41
% % Our equation is R I = V % Solve for I by solving I = inverse(R) V %
>> diary Sample1Out.txt >> MatlabSample1 I = 0.3291
0.1624 i = 1.1880 >> diary off
>> A = [ 1 2 3 4 ; 5 6 7 8 ; 3 4 5 6 ; 2 6 4 5] A = 1 2 3 4 5 6 7 8 3 4 5 6 2 6 4 5 >> B = [A(1,:)] B = 1 2 3 4 >> C = [A(:,2)] C = 2 6 4 6 >> D = [A(1:2,2)] D = 2 6 >> A = [ 1 2 3 4 ; 5 6 7 8 ; 3 4 5 6 ; 2 6 4 5] A = 1 2 3 4 5 6 7 8 3 4 5 6 2 6 4 5 >> F = [A(1,:) A(3,:)] F = 1 2 3 4 3 4 5 6 >> G = [A(1,:) ; A(3,:)] G = 1 2 3 4 3 4 5 6
>> A = [ 1 1 ; 1 1; 1 1] A = 1 1 1 1 1 1 >> B = A‘ ( Matrix transpose ) B = 1 1 1 1 1 1 >> C = B * A C = 3 3 3 3 >> D = B .* A ??? Error using ==> .* Matrix dimensions must agree. >> D = B(:,1:2) .* A(1:2,:) D = 1 1 1 1
t = [start-value: step-size: end-value]