Skip to content

cpl11001/01_ME3255_repo

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

01_ME3255_repo

HW Assignment #1

Answer to Homework Question 1

This semester I hope to become comfortable with Matlab to the point where I will be able to use it as a tool to solve engineering problems.

Problem 3 (2?)

A_66 = zeros(6,6);
for i = 1:6;
    for j = 1:6;
        A_66(i,j)=i*j;
    end
end

fprintf('mean of A_66 = %1.2f\nstdev of A_66= %1.2f\n', mean(A_66(:)), std(A_66(:)))

output:

  • mean of A_66 = 12.25
  • stdev of A_66 = 9.07

Problem 4

Part A

set(0,'defaultAxesFontSize',16)
set(0,'defaultTextFontSize',16)
set(0,'defaultLineLineWidth',3)
data = dlmread('US_energy_by_sector.csv',',',2,0);
plot(data(:,1),data(:,3),data(:,1),data(:,9))
xlabel('Year')
ylabel('Total Energy Consumption (Trillion BTU)')
title('Annual US Energy Consumption by Sector')
legend('Residential','Transportation','Location','Northwest')

US Energy Use per Year from 1949-2016

Part B

set(0,'defaultAxesFontSize',16)
set(0,'defaultTextFontSize',16)
set(0,'defaultLineLineWidth',3)
data = dlmread('US_energy_by_sector.csv',',',2,0);
x = cumtrapz(data(:,3))/(10^6)
y = cumtrapz(data(:,9))/(10^6)
plot(x)
hold on
plot(y)
hold off
xlabel('Year')
ylabel('Cumulative Energy Consumption (Quintillion BTU)')
title('Cumulative US Energy Consumption by Sector')
legend('Residential','Transportation','Location','Northwest')
![Cumulative Energy Use from 1949-2016](./figures/figure02.png)

Cumulative Energy Use from 1949-2016

Problem 5

Part A

Freefall Comparison

Problem 6

Part A

function [vx,vy,vz] = Hw1_Prob6a(x,y,z,t)
%Function used to calculate velocity in 3D
vx=diff(x)./diff(t)
%velocity is change in x vector divided by change in t. The dot indicates
%term by term division, rather than matrix by matrix
vy=diff(y)./diff(t)
%velocity is change in y vector divided by change in t. The dot indicates
%term by term division, rather than matrix by matrix
vz=diff(z)./diff(t)
%velocity is change in z vector divided by change in t. The dot indicates
%term by term division, rather than matrix by matrix
end

Part B

function [ax,ay,az] = Hw1_Prob6b(x,y,z,t)
%Function used to calculate velocity in 3D
vx=diff(x)./diff(t);
%velocity is change in x vector divided by change in t. The dot indicates
%term by term division, rather than matrix by matrix
vx=[vx(1),vx];
%Diff function makes matrix one column shorter, need to do this to
%calculate ax
vy=diff(y)./diff(t);
%velocity is change in y vector divided by change in t. The dot indicates
%term by term division, rather than matrix by matrix
vy=[vy(1),vy];
%Diff function makes matrix one column shorter, need to do this to
%calculate ay
vz=diff(z)./diff(t);
%velocity is change in z vector divided by change in t. The dot indicates
%term by term division, rather than matrix by matrix
vz=[vz(1),vz];
%Diff function makes matrix one column shorter, need to do this to
%calculate az
ax=diff(vx)./diff(t)
%acceleration is change in velocity in x direction divided by change in t.
%The dot indicates term by term division, rather than matrix by matrix
ay=diff(vy)./diff(t)
%acceleration is change in velocity in y direction divided by change in t.
%The dot indicates term by term division, rather than matrix by matrix
az =diff(vz)./diff(t)
%acceleration is change in velocity in z direction divided by change in t.
%The dot indicates term by term division, rather than matrix by matrix
end

About

HW Assignment #1

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages