Unable to convert expression into double array

2 ビュー (過去 30 日間)
duty duty
duty duty 2020 年 11 月 23 日
コメント済み: duty duty 2020 年 11 月 24 日
Dear all
In the code I would like to use sym function to calculate this function.But I keep getting this error.
"Unable to convert expression into double array.'
I=zeros(256,256);
syms t;
for i=1:256
for j=1:256
I(i,j)=1+cos(2*pi*(19.5+t)*i/1950/10^-4)-cos(2*pi*100*i);
end
end
  1 件のコメント
duty duty
duty duty 2020 年 11 月 24 日
Thanks!!

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

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 11 月 23 日
You are initializing I as double matrix, initialize it as a symbolic matrix
syms t;
I = zeros(256,256, 'like', t);
for i=1:256
for j=1:256
I(i,j)=1+cos(2*pi*(19.5+t)*i/1950/10^-4)-cos(2*pi*100*i);
end
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConversion Between Symbolic and Numeric についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by