Code for Lecture 2

# Code for Lecture 2 - %Setting limits from 0 to 2pi%Limit...

This preview shows page 1. Sign up to view the full content.

Lecture 2 Homework Code for Exercise 2.1 %l2p1 %Math 344 %Homework Problem 2.1 % or %Homework Lecture 2 Problem 1 ==> (l2p1) %Written by Bob Astrom % function y = c2p1(x) %name the function y = x.^2.* exp(-x.^2); %enter function Code for Exercise 2.2 %l2p2 %Math 344 %Homework Problem 2.2 % or %Homework Lecture 2 Problem 2 ==> (l2p2) %Written by Bob Astrom % %***Prints the curves for sin(nx); n=1 to 6***
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %Setting limits from 0 to 2pi %Limit increments of pi/100 x = 0:pi/100:2*pi; %Calculate valuses of sine s1x = sin(x); s2x = sin(2*x); s3x = sin(3*x); s4x = sin(4*x); s5x = sin(5*x); s6x = sin(6*x); %Plot results on one graph plot(x,s1x, 'b' ,x,s2x, 'k' ,x,s3x, 'r' ,x,s4x, 'g' ,x,s5x, 'y' ,x,s6x, 'c' )...
View Full Document

## This note was uploaded on 01/15/2011 for the course MATH 345 taught by Professor Staff during the Spring '08 term at Ohio State.

Ask a homework question - tutors are online