フィルターのクリア

能不能把下面储存在元​胞里面的t(i)换成​具体的值,是不是有强​制计算什么的

2 ビュー (過去 30 日間)
玉成
玉成 2022 年 6 月 28 日
コメント済み: 玉成 2022 年 6 月 29 日
代码:
clear
clc
t=[1 2 3 4 5]
for i=1:4
F{i}=@(a)t(i+1).^a-t(i).^a
end
结果:
F =
1×4 cell 数组
{@(a)t(i+1).^a-t(i).^a} {@(a)t(i+1).^a-t(i).^a} {@(a)t(i+1).^a-t(i).^a} {@(a)t(i+1).^a-t(i).^a}
  1 件のコメント
Walter Roberson
Walter Roberson 2022 年 6 月 29 日
Approximate translation:
Can you replace the t(i) stored in the cell below with a specific value? Is there any mandatory calculation?

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

採用された回答

Walter Roberson
Walter Roberson 2022 年 6 月 29 日
t=[1 2 3 4 5]
t = 1×5
1 2 3 4 5
for i=1:4
cmd = sprintf('@(a)%.16g.^a-%.16g.^a', t(i+1), t(i));
F{i} = str2func(cmd);
end
F
F = 1×4 cell array
{@(a)2.^a-1.^a} {@(a)3.^a-2.^a} {@(a)4.^a-3.^a} {@(a)5.^a-4.^a}
  1 件のコメント
玉成
玉成 2022 年 6 月 29 日
谢谢

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!