whats wrong with this code?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
function [drag] = aero_drag(dens,v,A)
Fd = 0.5 .* dens .* (v.^2) .* A .* 0.55.*sign(v);
drag = Fd
File: areo_drag.m Line: 1 Column: 10
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched
delimiters.
0 comentarios
Respuestas (1)
Star Strider
el 12 de Abr. de 2024
It works here.
How are you calling your ‘aero_drag’ function?
dens = rand
v = rand
A = randn(1,5)
drag = aero_drag(dens,v,A)
function [drag] = aero_drag(dens,v,A)
Fd = 0.5 .* dens .* (v.^2) .* A .* 0.55.*sign(v);
drag = Fd;
end
.
2 comentarios
Star Strider
el 12 de Abr. de 2024
Thank you!
It may simply have needed an end, or alternatively, needed to be put at the end of your script. (I’m not certain, because I don’t know where it was in your script, or how you called it.)
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!