Matlab problem - % Doing calculation and finding x x =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% This is my program for energy stored in a spring % Written by Emily Adams % Date: 1/14/11 % Homework Problem 2.16 % k = spring constant in newtons per meter % F = force in Newtons % E = energy in joules % x = compression of spring? % get user input F = [20 30 25 20]; k = [200 250 300 400];
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % Doing calculation and finding x x = F./k; % Input result from x and plug in to find energy stored in the spring E = .5.*k.*x.^2; % Determine which spring has most energy maxval = max(E); % Report results fprintf('Here is the result %g \n',maxval);...
View Full Document

This note was uploaded on 02/10/2011 for the course CPTR 125 taught by Professor Engineeringteacher during the Spring '11 term at Andrews University.

Ask a homework question - tutors are online