フィルターのクリア

symbolic calculation in MATLAB

1 回表示 (過去 30 日間)
YOGESHWARI PATEL
YOGESHWARI PATEL 2021 年 11 月 30 日
コメント済み: YOGESHWARI PATEL 2021 年 12 月 12 日
syms x t
U=zeros(1,2,'sym');
series1(x,t)=sym(zeros(1,1));
for k=1:10
U(k)=(-x)^k-1/(factorial(k))
end
for k=1:9
series1(x,t)=simplify(series1(x,t)+U(k)*(power(t,k-1)));
end
series1
C1=zeros(1);
for x=1:3:6
e=(x-1);
for t=1:3:6
f=(t-1)/10;
C1(x,t)=series1(e,f);
end
end
vpa(C1,15)
In command window following result is dispalyed:
[ -1.0, 0, 0, -1.16619602524777]
[ 0, 0, 0, 0]
[ 0, 0, 0, 0]
[ -4.0, 0, 0, -3.35685995524777]
Why in between zeros are diaplayed and if I dont want to dispaly the zeros what changes should I make?
  1 件のコメント
YOGESHWARI PATEL
YOGESHWARI PATEL 2021 年 12 月 12 日
thank you

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

採用された回答

Awais Saeed
Awais Saeed 2021 年 12 月 7 日
You are not storing in C1 properly. You are using x and t, whihc are incrementing with a step size of 3.
syms x t
U=zeros(1,2,'sym');
series1(x,t)=sym(zeros(1,1));
for k=1:10
U(k)=(-x)^k-1/(factorial(k));
end
for k=1:9
series1(x,t)=simplify(series1(x,t)+U(k)*(power(t,k-1)));
end
row = 0;
for x=1:3:6
row = row + 1;
col = 0;
e=(x-1);
for t=1:3:6
col = col + 1;
f=(t-1)/10;
C1(row,col)=series1(e,f);
end
end
vpa(C1,15)
ans = 
  1 件のコメント
YOGESHWARI PATEL
YOGESHWARI PATEL 2021 年 12 月 12 日
thank you

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by