Lecture+7-Matlab+programming

# Lecture+7-Matlab+programming - x=0:0.1:10;...

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.

## This note was uploaded on 11/07/2011 for the course EGM 3344 taught by Professor Raphaelhaftka during the Spring '09 term at University of Florida.

### Page1 / 18

Lecture+7-Matlab+programming - x=0:0.1:10;...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online