whats wrong with this code?
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Star Strider
on 12 Apr 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 Comments
Star Strider
on 12 Apr 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.)
See Also
Categories
Find more on Desktop in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!