The best way to understand Matlab commands is to read each line slowly and then
ID: 1995563 • Letter: T
Question
The best way to understand Matlab commands is to read each line slowly and then using a table write down the value for each variable you encounter. For example a column for the variable/counter 'm' and a column for 'Vdrop' as well as x(m). As shown in class on Wednesday, x(m) is a 'list' of values/numbers and it is called an 'array'. The other rule is a For Loop must be executed until the counter ('m') is complete/exhausted. A While Loop continues until the 'condition' is not met. Imagine a series circuit with three resistors which we called 'hurdles' because when the current flows through the resistor, energy is lost and there is a voltage drop as we 'jump over' the hurdle. Now suppose we write a Matlab routine/algorithm to sum up all the voltage drops in the Circuit. FILL IN THE 8 LAN ICS IN THE MATLAB ROUTINE BELOW: % This is a comment line with the percentage symbol % There are 3 resistors, R, each with a resistance of 1000 Ohms % The battery voltage, V is 3 Volts % The current through the circuit is V = 3V divided by 3000 Ohms or 1 milliAmp (1 mA or 0.001 Amps). This is Ohm's Law which you will be test on in the final exam. R = ______ I = _______ For m = 1: ______ Vdrop = ________ x(m) = Vdrop _______ xExplanation / Answer
R=[1000 1000 1000]%sresitance value in the loop( ohm)
I=1*10^-3%Current in the loop in Amps
for m=1:1:3
Vdrop=I*R(m);
x(m)=Vdrop;
end
X=sum(x)
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.