Why am I getting "Unrecognized function or variable 'fp'."?

Tried to make a fixed point iteration code in MATLAB, but I am not sure why I am unable to call my function without receiving this error.

답변 (1개)

DGM
DGM 2024년 8월 26일
편집: DGM 2024년 8월 26일

0 개 추천

Functions which are local to a script or local to another function are not accessible outside that scope. If you want your function to be accessible, it needs to be written as a function, not a script with a local function. Delete all the non-comment lines prior to the function() definition (get rid of clc; clear all).

댓글 수: 2

In addition to @DGM's advice, when calling the function, you'll need to use its file name:
>> fixedp(g,p0,tol,n)
Change the file name to fp.m if you want to use that name.
Oh good catch!

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

카테고리

도움말 센터 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

릴리스

R2024a

태그

질문:

2024년 8월 26일

댓글:

DGM
2024년 8월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by