How do i delete red box?

2 ビュー (過去 30 日間)
Ann Lee
Ann Lee 2022 年 4 月 1 日
コメント済み: Star Strider 2022 年 4 月 1 日
is there any solution to not showing that red box?
i tried type ; every last of sentences and i couldnt find..
function A=work5(x)
m=1;
fun =@(n) log(n)./(n.^2);
fun2 =cube=@(n)(factorial(n))/(n.^n);
y = 10:10:160;
for k = y
n=1:k;
a= sum(nthroot(n.^2,5)./((3.^n).*(n+1)));
A(1,m)=a;
a= sum((3*n.^2+n)/(2*n.^4+nthroot(n,2)));
A(2,m)=a;
a= sum((nthroot(37,2)*n.^3)/((2*n.^3)+(3*n.^2)));
A(3,m)=a;
a=sum(fun(n));
A(4,m)=a;
a=sum(fun(n));
A(5,m)=a;
m=m+1;
end
fprintf('k-sum\t\t%-10s\t%-10s\t%-10s\t%-10s\t%-10s\n','series a)',' series b)',' series c)',' series d)',' series e)');
fprintf('%-d-sum\t\t%18.16f\t%18.16f\t%18.16f\t%18.16f\t%18.16f\n',[y; A]);
end

採用された回答

Star Strider
Star Strider 2022 年 4 月 1 日
You forgot one semicolon.
That is the one following the function call itself:
A=work5(x);
Add it, and the problem should be resolved.
.
  2 件のコメント
Ann Lee
Ann Lee 2022 年 4 月 1 日
thank you!!!!
Star Strider
Star Strider 2022 年 4 月 1 日
As always, my pleasure!

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

その他の回答 (1 件)

Voss
Voss 2022 年 4 月 1 日
Put a semicolon at the end of the line where you call work5()
x = 0.5;
A=work5(x); % semicolon here to suppress output
k-sum series a) series b) series c) series d) series e) 10-sum 0.2360917042622818 0.0183477336900002 2.6037130567248910 0.6185026440390786 0.6185026440390786 20-sum 0.2360935069156409 0.0046901266642478 2.8014162630672139 0.7414543314498736 0.7414543314498736 30-sum 0.2360935069373981 0.0021024390062099 2.8760197072997613 0.7927133235796062 0.7927133235796062 40-sum 0.2360935069373984 0.0011879757954263 2.9152273498982542 0.8214707392666620 0.8214707392666620 50-sum 0.2360935069373983 0.0007624261816455 2.9394033796823531 0.8400856497460111 0.8400856497460111 60-sum 0.2360935069373983 0.0005304643434289 2.9558025281112354 0.8532083972941535 0.8532083972941535 70-sum 0.2360935069373983 0.0003902616907145 2.9676576344553687 0.8630014494171609 0.8630014494171609 80-sum 0.2360935069373983 0.0002991030456768 2.9766276503926639 0.8706140035662616 0.8706140035662616 90-sum 0.2360935069373983 0.0002365196042555 2.9836515597777193 0.8767161095759303 0.8767161095759303 100-sum 0.2360935069373983 0.0001917055505272 2.9893007392892499 0.8817261267819699 0.8817261267819699 110-sum 0.2360935069373983 0.0001585190387434 2.9939428224039832 0.8859194142887463 0.8859194142887463 120-sum 0.2360935069373983 0.0001332595661518 2.9978250830782560 0.8894849752852432 0.8894849752852432 130-sum 0.2360935069373983 0.0001135896806734 3.0011199661058376 0.8925570525004751 0.8925570525004751 140-sum 0.2360935069373983 0.0000979740413573 3.0039514025437972 0.8952337438272375 0.8952337438272375 150-sum 0.2360935069373983 0.0000853704311945 3.0064107493745813 0.8975884770604837 0.8975884770604837 160-sum 0.2360935069373983 0.0000750512206079 3.0085668320159584 0.8996773562961806 0.8996773562961806
function A=work5(x)
m=1;
fun =@(n) log(n)./(n.^2);
% fun2 =cube=@(n)(factorial(n))/(n.^n);
y = 10:10:160;
for k = y
n=1:k;
a= sum(nthroot(n.^2,5)./((3.^n).*(n+1)));
A(1,m)=a;
a= sum((3*n.^2+n)/(2*n.^4+nthroot(n,2)));
A(2,m)=a;
a= sum((nthroot(37,2)*n.^3)/((2*n.^3)+(3*n.^2)));
A(3,m)=a;
a=sum(fun(n));
A(4,m)=a;
a=sum(fun(n));
A(5,m)=a;
m=m+1;
end
fprintf('k-sum\t\t%-10s\t%-10s\t%-10s\t%-10s\t%-10s\n','series a)',' series b)',' series c)',' series d)',' series e)');
fprintf('%-d-sum\t\t%18.16f\t%18.16f\t%18.16f\t%18.16f\t%18.16f\n',[y; A]);
end

カテゴリ

Help Center および File ExchangeFinancial Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by