You are on page 1of 5

MATLAB Assignment 6

MATH 152
SUMMER 2014
Group Members: Timothy Huang, Ramon Yu
1. Ramon Yu (822006854)
2. Timothy Huang (422008329)
3. Ramon Yu (822006854)

% Ramon Yu Matlab 6_1


fplot('exp(-.2*x)*cos(2*x)-.15*x^2+1',[0 5])
x1=fzero('exp(-.2*x)*cos(2*x)-.15*x^2+1',1.3)
x2=fzero('exp(-.2*x)*cos(2*x)-.15*x^2+1',2)
x3=fzero('exp(-.2*x)*cos(2*x)-.15*x^2+1',3.1)

x1 =
1.3923

x2 =
2.0714

x3 =
3.1895

Published with MATLAB R2013a

%g315x12
%Timothy Huang
%r=s, R=R
%V=1/3 pi r^2 h
%h=R^2=sqrt(R^2-r^2)
%V=1/3 pi (r^2R+r^2sqrt(R^2-r^2)
[x fval]=fminbnd('-((pi/3).*(17.*x^2+x.^2.*sqrt(289-x.^2)))',14,17);
r=x
h=17+sqrt(17^2-r^2)

r =
16.0277

h =
22.6667

Published with MATLAB 8.0

function [y] = PotEnergy(x,R)


%UNTITLED4 Summary of this function goes here
%
Detailed explanation goes here
y=800*9.81.*(6371.^2./(6371+x).^2);
end
Error using PotEnergy (line 4)
Not enough input arguments.

Published with MATLAB R2013a

%Ramon Yu Matlab 6_3


q=quadl(@PotEnergy,0,500)

q =
3.6385e+06

Published with MATLAB R2013a