필터 지우기
필터 지우기

Folsve issues in function definition

조회 수: 1 (최근 30일)
Honey Adams
Honey Adams 2018년 8월 6일
댓글: Honey Adams 2018년 8월 6일
I have a system of nonlinear equations and I am trying to solve with the fsolve solver. I defined the function and the variables in the function but I had an error. Attached is the Matlab code of the function. I would be glad for any assistance.

채택된 답변

Stephen23
Stephen23 2018년 8월 6일
편집: Stephen23 2018년 8월 6일
Get rid of these two useless lines of code:
clear all
clc
They serve no relevant functional purpose, and just cause you bugs (like this one). The only reason beginners put clear at the start of everything that they write is because of this:
Do not put clear at the start of everything. It does not help: it created this bug. It is not related to your code's functionality. Well written code does not need clear (or atleast very rarely): if all variables are preallcoated (as they should be) and code is written in functions (as it should be) then MATLAB's inbuilt memory manager takes quite good care of allocating and clearing variables from memory.
  댓글 수: 6
Honey Adams
Honey Adams 2018년 8월 6일
Thank you for the link.So i modified it as suggested by the other contributor but it still doesnt run.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by