Afficher commentaires plus anciens

8 commentaires
Image Analyst
le 1 Jan 2023
I can't read that language but the equation goes in MATLAB exactly as it is written there. That is proper syntax.
daniel
le 1 Jan 2023
Torsten
le 1 Jan 2023
function v = velocity(x,y,z,t)
v = sqrt(diff(x).^2+diff(y).^2+diff(z).^2)./diff(t);
end
Done.
daniel
le 1 Jan 2023
Yes, then supply t,x,y and z as vectors of the same length.
Or check their lengths in the function.
Matt J
le 1 Jan 2023
See guidelines for homework help:
daniel
le 1 Jan 2023
Walter Roberson
le 1 Jan 2023
In the case of that error message, the problem is that you had accidentally created a variable named velocity that you are then trying to index. If there is a variable in scope and a function of the same name, MATLAB gives priority to the variable in scope.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

