Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Problem 5
  • Loading branch information
ayr13001 committed Nov 18, 2017
1 parent b726714 commit 482822a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
11 changes: 10 additions & 1 deletion README.md
Expand Up @@ -3,6 +3,7 @@ ME 3255
Homework 5

##Problem 2

Least Squares function
```matlab
function [a,fx,r2] = least_squares(Z,y);
Expand Down Expand Up @@ -159,6 +160,14 @@ Output:
- L = 5.0108 m
#Problem 5
###Part A
```matlab
cd_out_linear = sphere_drag(300,'linear') = 0.1750
cd_out_spline = sphere_drag(300,'spline') = 0.1809
cd_out_pchip = sphere_drag(300,'pchip') = 0.1807
```

### Part B
![Drag Force vs. Velocity (3 Interpolation Methods)](./figure5.png)

#Problem 6
###Analytical
Expand Down Expand Up @@ -190,7 +199,7 @@ tildex = (b-a)/2*x + (b+a)/2;
f = (1/6).*(tildex).^3+(1/2).*(tildex).^2+(tildex);
value2 = sum(tildec.*f)
```
###3-point
##3-point
```matlab
%Three Point
x = [-0.77459666,0,0.77459666];
Expand Down
Binary file added figure5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 21 additions & 5 deletions sphere_drag.m
@@ -1,10 +1,26 @@
function [Cd_out] = sphere_drag(Re_in,spline_type)
% interpolation for drag coeff based upon Reynolds number
% output is
% output is
% Cd: drag coeff
% input is
% input is
% Re_in: Reynolds number
% and
% and
% spline_type: 'linear', 'cubic', or 'spline'/'pchip'



%function [Cd_out]=sphere_drag(Re_in,spline_type)
data = [2 0.52
5.8 0.52
16.8 0.52
27.2 0.5
29.9 0.49
33.9 0.44
36.3 0.18
40 0.074
46 0.067
60 0.08
100 0.12
200 0.16
400 0.19];

Cd_out = interp1(data(:,1),data(:,2),Re_in,spline_type);
end

0 comments on commit 482822a

Please sign in to comment.