help with matlab error
Afficher commentaires plus anciens
Just need help with the problem
1st part of code is in the attahcment and heres the second part

I am getting an error that says "variable reshas an incorrect value" and "output arguement xroot and maybe others not assigned to during call to PA_secant" and "not enough output arguements"
8 commentaires
madhan ravi
le 25 Avr 2019
Attaching a picture is never useful than attaching code/code file.
Walter Roberson
le 25 Avr 2019
If i==imax the first iteration of the loop, then the break will be taken before anything is assigned to xroot or residual.
Tony Vo
le 25 Avr 2019
Tony Vo
le 25 Avr 2019
Walter Roberson
le 25 Avr 2019
What are the input values you are testing with?
Tony Vo
le 25 Avr 2019
Tony Vo
le 25 Avr 2019
Walter Roberson
le 25 Avr 2019
When I run your code with those parameters, I do not get any error message.
"Variable res has an incorrect value" looks like it might be from the automatic grading system.
Réponses (1)
Cris LaPierre
le 11 Mai 2019
Modifié(e) : Cris LaPierre
le 11 Mai 2019
0 votes
It looks like your teacher is using MATLAB Grader for this problem. Because of variable scope in a function, MATLAB Grader is calling your function with inputs your teacher defines, and assessing the outputs. It can not check any other variables. The outputs are captured in variables your teacher has named, which is why you see an error message about a variable your code does not create.
It would appear the output variable they named res is not being assigned the expected value by your function. The inference, then, is that your function has not been properly implemented.
I think it's safe to assume res = residual. Check how you are calculating your residual. Compare to your notes from class. If there is any feedback provided in this assessment test, use that to help find your mistake.
Communautés
Plus de réponses dans Distance Learning Community
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!