Unable to convert expression into double array

조회 수: 4 (최근 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

채택된 답변

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 CenterFile Exchange에서 Conversion 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