Write a MATLAB script that uses a FOR loop to simulate a leaky faucet. The leaky
ID: 1710024 • Letter: W
Question
Write a MATLAB script that uses a FOR loop to simulate a leaky faucet. The leaky faucet is dripping at a rate of one 0.1 milliliters drop every 3 seconds. Write a MATLAB script that plots the amount of water lost over 1 hour.
To do this, you will write a MATLAB script that generates a simple 2D plot of water lost in milliliters as a function of time over the course of 1 hour. You will need to use a FOR loop and compile the data into a vector within the loop. After completion of the FOR loop, you will plot the vector.
Explanation / Answer
close all
clear all
w= 0 ;
for ( i=3:3:3600)
w=w+0.1 ;
plot(i,w)
hold on
end
xlable('time(s)')
ylable('water lost(ml)')
%thanks
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.