필터 지우기
필터 지우기

Plotting inside a function

조회 수: 2 (최근 30일)
Seyifunmi Ayeni
Seyifunmi Ayeni 2018년 12월 1일
댓글: Walter Roberson 2018년 12월 1일
unfortunately I can't post my code as it is over 300 lines long but it is more a plotting issue. My function works but when I do add fplot in my code like this:
function [Q] = code(L)
%function body
fplot(code(L), [1 5])
end
and when I ran my function I did code(1) assuming after it finished solving for 1 it will plot the graph but it has been only solving for 1 repeatedly.
Any advice.

채택된 답변

Image Analyst
Image Analyst 2018년 12월 1일
That's because the (badly-named) function "code()" calls itself recursively!
That's why code() executes repeatedly.
  댓글 수: 4
Seyifunmi Ayeni
Seyifunmi Ayeni 2018년 12월 1일
I tried that and it seems to work (I'm not getting the same results each time) but when completed no graph pops up.
Walter Roberson
Walter Roberson 2018년 12월 1일
Can you attach your code?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by