ME218 Lab1

# ME218 Lab1 - 0 2 5 7>> A-D ans = 2 2 1 1>> D-B ans...

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

Greg Gangluff gg2593 1/29/08 Lab 1(MATLAB Review) 1- 3dozen is not a valid MATLAB name because it starts with a number instead of a lower or uppercase letter rickywilliams# = 22 , is not a valid variable name due to the # sign. MATLAB variable names can only contain uppercase and lowercase letters, numbers, and underscores. notTrue! = 0 is not a valid variable name due to the # sign. MATLAB variable names can only contain uppercase and lowercase letters, numbers, and underscores. 1.2 - >> bohr_radius = 9.27e-24 bohr_radius = 9.2700e-024 1.3 - >> x = 4e-5 + 3e-3*i x = 1.0+ 0.0030i 1.4 - >> format long, pi ans = 3.141592653589793 1.5 >> format short, t= x^y + w*v - z t = 130.8156 1.6 – The equations (v-150 ^ 1.1/10+x and v-(150 ^ 1.1)/10+x) result in the two same values. 1.7 - >> -3:1.7:10 1.8 - >> M = [ 0 2 3 5; 7 3 8 4] M = 0 2 3 5 7 3 8 4

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

View Full Document
>> N = [ 1 1 3 4 5 6 9 4 8] N = 1 1 3 4 5 6 9 4 8 1.9 – >>A+D ans =
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 0 2 5 7 >> A-D ans = 2 2 1 1 >> D-B' ans = -7 -7 -6 -6 >> D-77 ans = -78 -77 -75 -74 >> A/2 ans = 0.5000 1.0000 1.5000 2.0000 >> 2*D ans = -2 0 4 6 1.10 – >> M(7) ans = 5 1.11 – >> partofM = M(:, 1:3) partofM = 0 2 3 7 3 8 1.12 – >> size(D) ans = 3 1 >> size(N) ans = 3 3 1.13- Code, plot attached a=0.5; b=-0.5; t=0:0.1:70; for i=1:length(t) x(i)= sin(a*t(i))*exp(b*t(i)); x2(i)= sin(a*t(i))*cos(a*t(i)); v(i)= a*cos(a*t(i))*exp(b*t(i)) + b*sin(a*t(i))*exp(b*t(i)); end plot(t,x, '-' ) 1.14-Code, graph attached a=0.5; b=-0.5; t=0:0.1:70; for i=1:length(t) x(i)= sin(a*t(i))*exp(b*t(i)); x2(i)= sin(a*t(i))*cos(a*t(i)); v(i)= a*cos(a*t(i))*exp(b*t(i)) + b*sin(a*t(i))*exp(b*t(i)); end plot(t,x, '-' ) figure(3); plot( t, x, 'b-' , t, v, 'r:' ); xlabel( 'Time' ); title( 'Position vs. Time and Velocity vs. Time' ); axis( [0 70/3 -.15 .5 ] );...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern