This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 5-B.14function resultantF = physicsVectorSum(force_1, force_2)% compute vector sum of two vectors% INPUT: force_1, a (MATLAB) vector with N elements representing% an N-dimensional physical vector% force_2, a (MATLAB) vector with N elements representing% an N-dimensional physical vector% (N is the same for force_1 and force_2)% OUTPUT: resultantF, a N element (MATLAB) vector representing% the vector sum of the two inputsresultantF = force_1 + force_2;5-B.15function [massV, potentialEnergyV] = springsCompute(extDistV, sprConstV)% compute suspended mass and potential energy values for% a set of springs given corresponding static extension% distances and spring constants% INPUTS: extDistV, a vector of extension distances (m)% sprConstV, a vector of spring constants (N/m)% OUTPUTS: massV, a vector of mass values for each spring (kg)% potentialEnergyV, a vector of potential energy values% stored in each spring at the static% extension position (N-m)g = -9.81; % accel due to gravity (m/s/s),% minus sign expressed direction is "down"massV = -(sprConstV .* extDistV) / g; % (kg)potentialEnergyV = 0.5 * (sprConstV .* extDistV.^2); % (N-m)% sample call% D = [20 50 30 10 40]; S = [9 4 8 3 6] * 10^2;% [masses, potentialEnergyStored] = springsCompute(D, S)...
View Full Document
This note was uploaded on 03/30/2008 for the course CSE 131 taught by Professor Sticklen during the Spring '08 term at Michigan State University.
- Spring '08