whats wrong with this code?
15 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Star Strider
2024 年 4 月 12 日 2:30
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 件のコメント
Star Strider
2024 年 4 月 12 日 2:46
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.)
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!