forked from sed12008/ME3255S2017
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
updated lecture 05
- Loading branch information
Showing
14 changed files
with
662 additions
and
36 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function [ax,ay]=my_caller(x,y,t) | ||
% Help documentation of "my_caller" | ||
% This function computes the acceleration in the x- and y-directions given | ||
% three vectors of position in x- and y-directions as a function of time | ||
% x = x-position | ||
% y = y-position | ||
% t = time | ||
% output | ||
% ax = acceleration in x-direction | ||
% ay = acceleration in y-direction | ||
|
||
function v=diff_match_dims(x,t) | ||
v=zeros(length(t),1); | ||
v(1:end-1)=diff(x)./diff(t); | ||
v(end)=v(end-1); | ||
end | ||
|
||
[vx,vy]=my_function(x,y,t); | ||
|
||
ax = diff_match_dims(vx,t); | ||
ay = diff_match_dims(vy,t); | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function [vx,vy] = my_function(x,y,t) | ||
% Help documentation of "my_function" | ||
% This function computes the velocity in the x- and y-directions given | ||
% three vectors of position in x- and y-directions as a function of time | ||
% x = x-position | ||
% y = y-position | ||
% t = time | ||
% output | ||
% vx = velocity in x-direction | ||
% vy = velocity in y-direction | ||
|
||
vx=zeros(length(t),1); | ||
vy=zeros(length(t),1); | ||
|
||
vx(1:end-1) = diff(x)./diff(t); % calculate vx as delta x/delta t | ||
vy(1:end-1) = diff(y)./diff(t); % calculate vy as delta y/delta t | ||
|
||
vx(end) = vx(end-1); | ||
vy(end) = vy(end-1); | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function P=nitrogen_pressure(v,T) | ||
% function to calculate Pressure of Nitrogen using ideal gas law given the specific | ||
% volume, v (m^3/kg), and temperature, T (K) | ||
% Pv = RT | ||
% R=0.2968; % kJ/kg-K | ||
% P [in kPa] = nitrogen_pressure(v [in m^3/kg], T[in K]) | ||
R=0.2968; % kJ/kg-K | ||
P=R*T./v; | ||
end | ||
|
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set(0, 'defaultAxesFontSize', 16) | ||
set(0,'defaultTextFontSize',14) | ||
set(0,'defaultLineLineWidth',3) |