Subscripted assignment dimension mismatch (size [1 x 1] ~= size [30 x 30]).
1 次查看(过去 30 天)
显示 更早的评论
Hi, I am new on MATLAB/SIMULINK environemt. I am trying to add a matlab function box inside a simulink model. I am importing some of the input signals from the workspace but i got the errors: Subscripted assignment dimension mismatch (size [1 x 1] ~= size [30 x 30]).
Also, how should the input dimensions be related to the script?
Below the script of the matlab fcn block
Thanks a lot
function T_sb1 =fcn(Tg,T_f,m1,U_p1)
cp=4.186;
L=30;
n=10;
dx=L/(n+1);
dt=900;
D=150;
dV=((D/(2*1000))^2)*pi*dx;
dA=((D/1000)*dx*pi);
A=((D/(2*1000))^2*L*pi);
% m1=0.5;
ro=1000;
B=(1+((m1/(dV*ro))*dt)+(U_p1*dA*dt/(2*dV*ro*cp)));
C=(m1*dt/(dV*ro));
D=(U_p1*dA*dt/(2*dV*ro*cp));
T=zeros(n,n);
for j=1:n,
for i=1:n,
T(1,1)=Tg;
T(i+1,1)=Tg;
T(1,j+1)=T_f;
T(i+1,j+1) = (T(i+1,j)+C*(T(i,j+1))-D*(T(i,j+1))+(D*2*Tg))/B;
end
end
T_sb1=T(n,:)';
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!