Question

As part of designing a robot, you have been asked to perform a number of programming...

As part of designing a robot, you have been asked to perform a number of programming tasks in MATLAB. In Part A, your programming tasks relate to the analysis of the electrical properties of the robot. When the robot is turned on, the voltage and current being used by the robot are recorded in 5 ms time intervals. This data is stored in a matrix where the first column contains time (t), the second column contains voltage (v) and the third column contains current (i). Q1 Description Create a function that accepts the data matrix as an input. The function should output an electrical power column vector and display a plot of electrical power vs. time (Note: ) .

0 0
Add a comment Improve this question Transcribed image text
Answer #1

%save the function as calculate_electric_power.m

function p=calculate_electric_power(matrix)
t=matrix(:,1);
%power =v*i;
p=matrix(:,2).*matrix(:,3);
plot(t,p)
xlabel('time');ylabel('Power');
end

%now execute below code from new file.m

t=0:5:100;
v=0:1:20;
i=0:2:40;
matrix=[t;v;i]';
calculate_electric_power(matrix)

Edit View k Insert a Tools Desktop Window DVA Help DE Editor - G:\MATLAB\R2017a\bin\calculate_electric pow File +106 inp_heig

2 - Go To - Find, 1 NAVIGATE R2017a Insert Efx - 3 D Run Section 0 Comment % %%% Breakpoints Run Run and El Advance Run and I

Add a comment
Know the answer?
Add Answer to:
As part of designing a robot, you have been asked to perform a number of programming...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT