대강 느낌이
선언블락/ 인수 선언하고
함수블락/ 함수 정의하고
프로그램블락/ 정의한 함수를 사용하는 스크립트
이걸 한 문서안에 넣고 싶어서
% Declare block, 선언
max=5;
min=1;
i=1;
n=1;
h=1;
% block 1 for finction, Err val functoin
function y = Err(max, min, n, x) 오류발생 Function definitions are not permitted in this context.
h = (max - min)/n;
if rem(n/2==0)
y = (h^(n+1))/factorial(n+1);
else
y = (h^(n+1))/factorial(n+1);
end
end
% Program start
for n = (1:1:1000)
~~
이런식으로 넣어봤는데
Function definitions are not permitted in this context.
라고 뜨더라..
걍 m파일로 함수 만드는건 아는데 걍 한꺼번에 넣고 싶은데 불가능한건가?
댓글 0