The following error occurred converting from sym to double: Unable to convert expression into double array.
조회 수: 2 (최근 30일)
Hi, I am attempting to form a symbolic 2x2 matrixwith the following code, however i keep reciveing the error message "The following error occurred converting from sym to double: Unable to convert expression into double array. Error in untitled (line 31)A(n)=q.(A(n)+A(n+4))/(a-n^2);" Im not sure how to solve this can anyone help?
b= randi([0 1],101,1);
A=[0,0,A,0,0]; %A vector with of length 101+4
t=0:1/104:1; %time axis with a sampling frquency of 100
syms a q
plot(t,x1); %Plot of x1
% sine part
% Transformation equation for A
% Transformation equation for B
M=[A(n) 0; 0 B(n)];
Aman Vyas 2020년 11월 5일
You can try by considering A(n) also as sym function since that is used in RHS. I tried from my end and was able to remove that error. For more information on sym you can follow:
Also the follow up issue in plot function can be resolved using fplot function.
Hope it helps !