Error on Matlab grading system - Variable y has an incorrect value.
이전 댓글 표시
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
Cris LaPierre
2022년 1월 6일
편집: Cris LaPierre
2022년 1월 8일
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
2023년 6월 19일
Can you give me code here, seems interesting
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!