Grader says answer Verified in Reference Solution is wrong
조회 수: 3 (최근 30일)
이전 댓글 표시
% define the limits of the for loop
forbeg=1;
forend=5;
for i = forbeg:forend
% Compute velocity (m/s) for each row
U = manning(n(i),S(i),B(i),H(i));
%output input and output
fprintf('%8.3f %8.3f %6d %8.2f %8.3f \n', n(i),S(i),B(i),H(i),U)
end
When I try to validate this reference solution testing the value of the variable forend, I get the errror
'Unable to resolve the name referenceVariables.forend'
Here is the code for testing the function:
assessVariableEqual('forend', referenceVariables.forend,toleranceAbsolute,0.0001);
댓글 수: 0
답변 (1개)
Cris LaPierre
2021년 9월 18일
편집: Cris LaPierre
2022년 4월 4일
It doesn't appear that you've shared all your code, as I get an error about n being undefined. Obviously, that will be true for S, B, H and U as well. I'll assume they are actually defined in your code.
Yout name-value pair for tolerance is incorrect as well. The correct name is AbsoluteTolerance. However, since you are just applying the default tolerance of +/- 0.0001, it is actually unnecessary (unless you only want to apply an absolute tolerance and ignore relative tolerance).
Once I simplify everything to be just a test for forend, it works just fine. If you are still having the same issue, can you please share all of your code?
% reference solution
forend=5;
% MATLAB Code assessment
assessVariableEqual('forend', referenceVariables.forend);
Here's a screenshot of the result of validating the simplified problem in Grader.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!