Error with MATLAB function findcrossing "too many input arguments"
86 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Oliver
am 13 Jan. 2024
Kommentiert: Jose
am 28 Apr. 2024 um 17: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
- Modify the definition of the findcrossing function so that it takes a third input z.
- Add a new line to the beginning of the function:y = y - z;
- In the Task 1 section of the script, change the value of y0 to 0.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".
0 Kommentare
Akzeptierte Antwort
Pooja Kumari
am 13 Jan. 2024
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 Kommentare
Om
am 19 Feb. 2024
scroll down below further practice of the solution and update the given code on your answer on the same place
Jose
am 28 Apr. 2024 um 17:10
you just need enter to
"Error using zerofunction>findcrossing
Too many input arguments"
This link show you a code and then you do the first two steps
- Modify the definition of the findcrossing function so that it takes a third input z.
- Add a new line to the beginning of the function:y = y - z;
function xcross = findcrossing(x,y,z)
y=y-z
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!