showing error in simp, too many ouput arguments

3 ビュー (過去 30 日間)
DEBABRATA DAS
DEBABRATA DAS 2021 年 7 月 31 日
コメント済み: DEBABRATA DAS 2021 年 8 月 1 日
function SIMP(FC,M)
% IMPLICIT DOUBLE PRECISION(A-H,O-Z)
% DIMENSION FC(141)
SI=FC(1)+FC(M);
IP=4;
%C JM=M-1
for I=2:M-1
SI=SI+IP*FC(I);
IP=6-IP;
SIMP=1.0*SI/(3.0*(M-1));
end
end
when i run it, showed error using simpmson 1/3, too many output argument, i coopy it from fortran
  2 件のコメント
Chunru
Chunru 2021 年 8 月 1 日
編集済み: Chunru 2021 年 8 月 1 日
Not sure what you want to do. The following is trying to correct the syntax error.
function y=SIMP(FC,M)
% IMPLICIT DOUBLE PRECISION(A-H,O-Z)
% DIMENSION FC(141)
SI=FC(1)+FC(M);
IP=4;
%C JM=M-1
for I=2:M-1
SI=SI+IP*FC(I);
IP=6-IP;
end
y=1.0*SI/(3.0*(M-1));
end
DEBABRATA DAS
DEBABRATA DAS 2021 年 8 月 1 日
i am using this function in another program, but not running

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

回答 (1 件)

KSSV
KSSV 2021 年 8 月 1 日
You are not taking any output from the function in the code. And I suspect you are trying to call the function with an output, so this error is popping out.
Take the required variable as output from the function, as suggested by @Chunru and then call the function:
y=SIMP(FC,M) ;

カテゴリ

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