필터 지우기
필터 지우기

Error with MATLAB function findcrossing "too many input arguments"

조회 수: 22 (최근 30일)
Oliver
Oliver 2024년 1월 13일
댓글: Mohamed Housni 2024년 6월 10일
Ive been doing the MATLAB fundamentals code when I stumbled upon this error.
Initially the Code says:
y0 = 0;
yline(y0)
tzerox = findcrossing(t,x)
tzero
y = findcrossing(t,y)
TASK
  1. Modify the definition of the findcrossing function so that it takes a third input z.
  2. Add a new line to the beginning of the function:y = y - z;
  3. In the Task 1 section of the script, change the value of y0 to 0.4.
  4. Modify the two calls to findcrossing to add y0 as an input.
You can use the graph to check that the returned values of t are correct (x(t) = 0.4 and y(t) = 0.4)
I modified the code:
y0 = 0.4;
yline(y0)
tzerox = findcrossing(t,x,y0)
tzeroy = findcrossing(t,y,y0)
which is also the solution provided by MATLAB itself, but it says "Error using zerofunction>findcrossing. Too many input arguments".

채택된 답변

Pooja Kumari
Pooja Kumari 2024년 1월 13일
Hi,
As per my understanding, you are facing "Error using zerofunction>findcrossing. Too many input arguments" error. You are getting this error because you have not updated the "findcrossing" function and the "findcrossing" function is being called with three arguments, its current definition only allows for two input arguments.
To resolve this error, you need to modify the definition of the findcrossing function to include the third input argument "z". Additionally, you need to add the line " y = y - z"; at the beginning of the function to adjust the values based on the new input. You can refer to the below code for the modification of "findcrossing" function:
function tzero = findcrossing(t, y, z)
Hope this helps!
  댓글 수: 3
Om
Om 2024년 2월 19일
scroll down below further practice of the solution and update the given code on your answer on the same place
Jose
Jose 2024년 4월 28일
you just need enter to
Too many input arguments"
This link show you a code and then you do the first two steps
  1. Modify the definition of the findcrossing function so that it takes a third input z.
  2. Add a new line to the beginning of the function:y = y - z;
function xcross = findcrossing(x,y,z)
y=y-z

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

추가 답변 (2개)

Natasha
Natasha 2024년 5월 2일
  1. Modify the definition of the findcrossing function so that it takes a third input z.
  2. Add a new line to the beginning of the function:y = y - z;
  3. In the Task 1 section of the script, change the value of y0 to 0.4.
  4. Modify the two calls to findcrossing to add y0 as an input.
You can use the graph to check that the returned values of t are correct (x(t) = 0.4 and y(t) = 0.4).
  댓글 수: 1
Mohamed Housni
Mohamed Housni 2024년 6월 10일
what's please the final solution or please could you update the belwo solution provided by MATLAB
ThemeCopy
y0 = 0.4;
yline(y0)
tzerox = findcrossing(t,x,y0)
tzeroy = findcrossing(t,y,y0)

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


Mohamed Housni
Mohamed Housni 2024년 6월 10일
what's please the final solution or please or could you update the belwo solution provided by MATLAB
y0 = 0.4;
yline(y0)
tzerox = findcrossing(t,x,y0)
tzeroy = findcrossing(t,y,y0)
  댓글 수: 1
Steven Lord
Steven Lord 2024년 6월 10일
You've modified the call to the findcrossing function. But you have not modified the definition of the findcrossing function. To complete the exercise you need to modify both the call and the definition; the call to pass the additional input into findcrossing and the definition to accept that additional input and do something useful with it.

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

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by