Code Previously Worked, Now keep getting "Unexpected Matlab Expression"..

function [t,x,u] = vehicleModel(0,10)
[t,u] = ode45(@vehicleAccel, [10], 0, options);
x = cumtrapz(t,u);
return
The Code above is a function file which links to two other functions, and all together are run off another script. Earlier in the day, the file worked, and I was able to plot a graph off it. Now, it doesnt work, and the only thing I changed, was a value assigned to a variable in a separate function. How can I resolve this? Matlab is saying the 0 in the first line is what is causing the problem.

답변 (2개)

Adam
Adam 2015년 2월 25일

0 개 추천

Have you defined a variable called vehicleModel?
If so Matlab will attempt to index into that variable with your arguments rather than call the function

댓글 수: 1

vehicleModel is the name of the function. Its then called into the last script I use to plot two variables that are found from the 3 functions. At least that was my understanding of how it worked? The problem is, is that it worked literally 3 hours ago.

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

function vehicleModel(0,10)
A variable name must start with a letter, and a function must take in variables.
function vehicleModel(q,k)
Will work since q and k are valid variable names.
The values of q and k could be anything

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2015년 2월 25일

답변:

2015년 2월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by