필터 지우기
필터 지우기

How to go about programming this function in MatLab

조회 수: 1 (최근 30일)
t sizzle
t sizzle 2021년 4월 20일
댓글: Rena Berman 2021년 5월 6일
I am trying to program a function into matlab but I am struggling to get started. I want to program it as a function and not as part of a script so that I may use it later on when I need it.
Basicaly, there will be n number of terms, and x and y are arrays that will change in size depending on how have set them up.
  댓글 수: 2
Stephen23
Stephen23 2021년 4월 28일
편집: Stephen23 2021년 4월 28일
Original question retrieved from Google Cache:
I am trying to program a function into matlab but I am struggling to get started. I want to program it as a function and not as part of a script so that I may use it later on when I need it.
Basicaly, there will be n number of terms, and x and y are arrays that will change in size depending on how have set them up.
Rena Berman
Rena Berman 2021년 5월 6일
(Answers Dev) Restored edit

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

답변 (2개)

Walter Roberson
Walter Roberson 2021년 4월 20일
c = @(x,y) sum(sqrt((a-x).^2 + (b-y).^2))

Jan
Jan 2021년 4월 20일
function c = YourSum(x, y, a, b)
c = sum(sqrt((a - x).^2 + (b - y).^2));
end

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by