フィルターのクリア

whats wrong with my code

1 回表示 (過去 30 日間)
lana john
lana john 2020 年 5 月 23 日
コメント済み: John D'Errico 2020 年 5 月 23 日
function fact[a,b,c]=my_fact(x)
if x>0
s=1;
for i=1:x
s=s*i;
end
a=f
end
elseif x==0
b=1
elseif x<0
ms='enter a +ve number'
c=error(ms)

回答 (1 件)

John D'Errico
John D'Errico 2020 年 5 月 23 日
I wouldstart by saying this is not how you define a function.
function fact[a,b,c]=my_fact(x)
That is not valid syntax to define a function in MATLAB.
  2 件のコメント
lana john
lana john 2020 年 5 月 23 日
so how to define it?
John D'Errico
John D'Errico 2020 年 5 月 23 日
You seem to be asking some pretty basic questions. Why not try reading the getting started tutorials?
Even so, rather than my writing how to define a function, you should read what is already written in a great deal of depth, here:

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by