Question

In: Mechanical Engineering

Assuming that the variables a, b, c, d, and f are scalars, write MATLAB statements to compute and display

Assuming that the variables a, b, c, d, and f are scalars, write MATLAB statements to compute and display the following expressions. Test your statements for the values a = 1.12, b = 2.34, c = 0.72, d = 0.81, and f = 19.83.

a b - a x = 1 + b d - c 1 1f y = ab с 2 r = d +루 +무

Solutions

Expert Solution

Write a MATLAB code to calculate the value of expression, x = 1 + 1/b + c/f2.

>>a=1.12; b=2.34; c=0.72;d=0.81;f=19.83;

>> x = 1 + a/b + c/f^2

x =

1.4805

 

Therefore, the value of is 1.4805.

 

Write a MATLAB code to calculate the value of expression, s = b – a/d – c

>>a=1.12; b=2.34; c=0.72;d=0.81;f=19.83;

>> s = (b-a)/(d-c)

s =

13.5556

 

Therefore, the value of is 13.5556.

 

Write a MATLAB code to calculate the value of expression, r = 1/(1/a + 1/b + 1/c + 1/d).

>>a=1.12; b=2.34; c=0.72;d=0.81;f=19.83;

>> r = 1/(1/a + 1/b + 1/c + 1/d)

r =

0.2536

 

Therefore, the value of r is 0.2536.

 

Write a MATLAB code to calculate the value of expression, y = ab 1/c f2/2.

>>a=1.12; b=2.34; c=0.72;d=0.81;f=19.83;

>> y = a*b/c*f^2/2

y =

715.6766

 

Therefore, the value of is 715.6766.


Therefore, the value of is 715.6766.

Related Solutions

Assume that: float a, b, c, d, f; and variables b, c, d, f are initialized....
Assume that: float a, b, c, d, f; and variables b, c, d, f are initialized. Write a line of c++ code that calculates the formula below and stores the result to the variable a:
Write a MATLAB assignment statement for each of the following functions, assuming that w, x, y, and z are row vectors of equal length and that c and d are scalars.
Write a MATLAB assignment statement for each of the following functions, assuming that w, x, y, and z are row vectors of equal length and that c and d are scalars.
Write a Matlab m-script to compute the backward difference approximation A = f(a)−f(a−h) h of the...
Write a Matlab m-script to compute the backward difference approximation A = f(a)−f(a−h) h of the derivative T = f0(a) for f(x) = sin(x) and a = π/3 using each value of h in the sequence 2−n (n = 1,2,3,···,52).
Write matlab program to compute ∫f(x)dx lower bound a upper bound b using simpson method and...
Write matlab program to compute ∫f(x)dx lower bound a upper bound b using simpson method and n points. Then, by recomputing with n/2 points and using richardson method, display the exact error and approximate error. (Test with a=0 b=pi f(x)=sin(x))
Let A = {a, b, c, d} and B = {b, d, e}. Write out all...
Let A = {a, b, c, d} and B = {b, d, e}. Write out all of the elements of the following sets. (a) B ∩ ∅ (b) A ∪ B (c) (A ∩ B) × B (d) P(A\B) (e) {X ∈ P(A) | |X| ≤ 3}
write a program that evaluates the following arithmetic expression: ((A+B)/C)*((D-A)+E). Assign test values to the variables...
write a program that evaluates the following arithmetic expression: ((A+B)/C)*((D-A)+E). Assign test values to the variables and display the resulting value.
Given a Boolean function: f(a,b,c,d) = m(1,6,7,10,12)+dc(3,4,9,15). i) Design a circuit for implementing f(a,b,c,d) with ONE...
Given a Boolean function: f(a,b,c,d) = m(1,6,7,10,12)+dc(3,4,9,15). i) Design a circuit for implementing f(a,b,c,d) with ONE 4-to-1 MUX and other basic logic gates. USE a and b as select inputs. ii) Draw the circuit. iii) Write the VHDL code for a 4-to-1 MUX, named “mux_4to1”, with input: a, b, c, d, s0, s1; and output: z. iv) Write the complete VHDL code for the above circuit in part (iii), named “Boolean_MUX”.
Seven people (A,B,C,D,E, F, and G) are seated in a row. Suppose A,B, and C are...
Seven people (A,B,C,D,E, F, and G) are seated in a row. Suppose A,B, and C are freshmen, D and E are sophomores and F and G are juniors. How many arrangements are possible if: (a) D and F must sit together? (b) A and C must not sit together? (c) All freshmen must sit together? (d) All freshmen must sit together, all sophomores must sit together, and all juniors must sit together? (e) Exactly two people sit between A and...
If there are 7 total notes C, D, E, F, G, A, and B and if...
If there are 7 total notes C, D, E, F, G, A, and B and if a five-note melody is selected at random (so that all melodies counted in part (a) are equally likely to be chosen), what is the probability that the melody will include exactly two “A” notes, but no other repeated notes? (A few allowable examples: AACEG, ACAEG, DFACA, EAABC, etc.)
1.            Determine whether the function f from { a, b, c, d } to {a,...
1.            Determine whether the function f from { a, b, c, d } to {a, b, c, d, e} is injective (one-to-one), surjective (onto) and/or bijective (one-to- one correspondence) : f(a) = a,            f(b) = c,            f(c) = b, f(d) = e a. Is this function injective?              . surjective?              . bijective?              . If your answer is no for any of the above, explain:             b. Is there an inverse for this function?              . c. Is the composition f...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT