Please help me, I’m using MATLAB Please don’t use for loop I haven’t learned tha
ID: 3754432 • Letter: P
Question
Please help me, I’m using MATLAB Please don’t use for loop I haven’t learned that in class yet Please make it easy and simple to understand Please have the output look like the box (in the picture) Thanks! 42. A vectorvstores for several employees of the Green Fuel Cells Corporation their Export PO hours worked 1 week followed for each by the hourly pay rate. For example, if the variable stores S> v Adobe Export PC Convert PDF Files t ox Excel Online 33.0000 10.5000 40.0000 18.0000 20.0000 7.5000 that means the first employee worked 33hours at $10.50 per hour, the second worked 40 hours at $18 an hour, and so on. Write code that will separate this into two vectors, one that stores the hours, worked and another that stores the hourly rates. Then, use the array multiplication operator to create a vector storing in the new vector the total pay for every employee Convert and e with Acrobat Start Free 1. (Attaway Q2.42) Prompt the user for the vector of hours and pay rate data. Sample output: Enter a vector of esployee hours and pay rate data: 33 10.5 40 18 20 7.5 The total pay for each employee is: 346.50 720.00 150.00 Enter a vector of employee hours and pay rate data: [ 40 50 10 15.5 The total pay for each employee is: 2000 155Explanation / Answer
MATLAB CODE
function [v1, v2] = DivideVectorIntoTwo (v)
v1=v(1:2:end); % odd position values
v2=v(2:2:end); % even position values
disp(v1.*v2) % multiply two vectors and display
end
OUTPUT-1
INPUT: [33 10.5 40 18 20 7.5]
OUTPUT-2
INPUT: [40 50 10 15.5]
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.