Error on Matlab grading system - Variable y has an incorrect value.
Ältere Kommentare anzeigen
For a MATLAB course, I have to program a code to compute the voltage at three junctions of an electrical system such as the one depicted below:

Following Kirchhoff's First Law, I have designed the following code:
function volt = voltage(V, R)
a = [(R(7)*R(2)+R(1)*R(7)+R(1)*R(2)), -R(1)*R(2), 0; (R(3)*R(8)*R(4)), (R(7)*R(8)*R(4)-R(3)*R(8)*R(4)-R(3)*R(7)*R(4)+R(3)*R(7)*R(8)), (R(3)*R(7)*R(4)); 0, (R(5)*R(6)), (R(8)*R(6)+R(5)*R(8)-R(5)*R(6))]; %3x3 matrix containing the value oh the resistance at each junction as functions of A, B and C
b = V*[(R(7)*R(2)); (R(7)*R(8)*R(4)); (R(8)*R(6))]; %1x3 matrix, product of solving Kirchhoff's firs law for each junction
volt = a\b;
end
When I run it on MATLAB, it works. When I run it on the platform, it works too. But when I try to submit my assignement, the following error appears:
Variable y has an incorrect value. Input was V = 10 and R = [1,2,4,5,13,4,8,1]

What am I doing wrong?
2 Kommentare
Cris LaPierre
am 6 Jan. 2022
Bearbeitet: Cris LaPierre
am 8 Jan. 2022
EDIT: Moving OP's comment here
I mean that it worked on my installed version of MATLAB, i.e. that I indroduced some V and R values and I obtained the expected voltage on A, B and C. I attach an image of the question, so you can see how did I obtain those matrixes:

So, when I said that it worked, I meant that I introduce those suggested R values at the end, and I obtanied the desired voltages, both on my installed MATLAB version and on the grading system, but then the errro appeared...
Thanks for replying!
Shaikat Saha
am 19 Jun. 2023
Can you give me code here, seems interesting
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!