{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture+7-Matlab+programming

# Lecture+7-Matlab+programming - x=0:0.1:10 y=sin(2*pi*x...

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

» x=0:0.1:10; » y=sin(2.*pi*x)+cos(pi*x); » H1=plot(x,y,'m'); set(H1,'LineWidth',3); hold on; » H2=plot(x,y,'bO'); set(H2,'LineWidth',3,'MarkerSize',10); hold off; » xlabel('x'); ylabel('y'); » title('y = sin(2\pix)+cos(\pix)'); » print -djpeg075 function.jpg

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

View Full Document
» x=0:0.1:3; y1=exp(-x); y2=sqrt(x); » H=plot(x,y1,'b-',x,y2,'r--'); » set(H,'LineWidth',3) » xlabel('x'); ylabel('y'); title('MATLAB Plots'); » H1=text(1.8,0.2,'exp(-x)'); set(H1,'FontSize',18); » H2=text(1.8,1.3,'sqrt(x)'); set(H2,'FontSize',18);
» text (17, 120, Record High ) » text (85, -40, Record Low ) » axis ([0 100 -50 140]) » hold off text ( x_location, y_location, text ) axis ( [ x_min x_max y_min y_max ] ) - text string Graphics Commands Text & Axis

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

View Full Document
Chapter 3 Programming with MATLAB
Newton’s Second Law Euler’s method To obtain good accuracy, it is necessary to use many small steps Extremely laborious and time-consuming to implement by hand Numerical Solution 2 d 2 d v m c g dt dv v c mg dt dv m - = - = ) ( ) ( ) ( ) ( i 1 i 2 i d i 1 i t t t v m c g t v t v - - + = + +

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

View Full Document
M-Files: Scripts and Functions You can create and save code in text files using MATLAB Editor/Debugger or other text editors (called m-files since the ending must be .m)
This is the end of the preview. Sign up to access the rest of the 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