Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Matlab Question: Please don\'t copy the other answer for this problem on Chegg,

ID: 3279389 • Letter: M

Question

Matlab Question:

Please don't copy the other answer for this problem on Chegg, I would like to have a different answer.

6) In Finite Element, the one dimensional Springs Element are said to be connected "in series" if the same forces passes through each and "in parallel" if the same displacement is applied across each. The equivalent stiffness constant for each model can be obtained as spring 1. k spring 2. spring 3, k, in parallel In Parallel In Series K, Write an M-File that prompts the user forwwwWF the type of connection (Series or Parallel) and the number of springs n and then computes the Equivalent Spring 1 Spring 2 Spring 3 in series Spring stiffness keq HINT: use the command "input (prompt, 's') " and K 2.50 August 31, 2017 ME 213 Sec. 2: Lecture 4

Explanation / Answer

prompt = 'Are the springs in series or parallel?';

x = input(prompt);

prompt = 'Number of springs is?';

y = input(prompt);

prompt = 'Stiffness of each spring?'

z = input(prompt)

tf = isstring(x);

tf1 = isnumeric(y);

tf2 = isnumeric(z);

a = 0;

if tf && tf1 && tf2

if x == 'parallel' || 'Parallel' || 'PARALLEL'

a = y*z;

elseif x == 'series' || 'Series' || 'SERIES'

a = z/y;

else

fprintf 'Error in input';

else

fprintf ' Error in Input Format';

if a != 0

disp(a);

else

end;