Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2008-11-06
年龄: 42
帖子: 7
声望力: 0 ![]() |
![]()
我在使用matlab对有限元软件comsol的结果作后处理的时候使用reshape, 遇到error, 没有想明白请大家指教.
solnum=1; x_max=120e-9; x_min=-120e-9; % set the boundary of model y_max=20e-9; y_min=0; z_max=120e-9; z_min=-120e-9; M=48; % # of mesh element along x N=(y_max-y_min)*M/(x_max-x_min);% along y L=(z_max-z_min)*M/(x_max-x_min); [R,x,y,z,r]=tetra2cubic(fem,solnum,x_max,x_min,y_max,y_min,z_max,z_min,M,N,L); function [R,x,y,z,r]=tetra2cubic (fem,solnum,x_max,x_min,y_max,y_min,z_max,z_min,M1,N1,L1) x=linspace(x_min,x_max,M1); z=linspace(z_min,z_max,L1); y=linspace(y_min,y_max,N1); [x,y,z]=meshgrid(x,y,z); xx=[x( ![]() ![]() ![]() r=postinterp(fem,'u',xx,'solnum',solnum); r(isnan(r))=0; R=reshape(r,N1,M1,L1); 显然 M=48, N=4, L=48. 但是调用tetra2cubic的时候 在最后一句reshape报错如下: ??? Error using ==> reshape Size arguments must be real integers. Error in ==> tetra2cubic at 18 R=reshape(r,N1,M1,L1); 但是如果我把 M 改为60, 也就是[M,N,L]=[60,5,60], 则不会报错. 或者在调用的function里面重新定义一下M,N,L也不会报错. 我认为自己在reshape中使用的参数都是real integer, 为何会出现错误哪? 请大家指教. 谢谢 |
![]() |
![]() |
![]() |
|
|
![]() |
||||
主题 | 主题作者 | 版面 | 回复 | 最后发表 |
MWNumericArray精度问题 | 未注册 | MATLAB论坛 | 1 | 2011-09-25 17:07 |
[求助]如何把一个包含0和1的矩阵中的相邻的1都加起来 | appleceo | MATLAB论坛 | 3 | 2009-03-27 21:52 |
[求助]IIR滤波器程序求助 | selina | MATLAB论坛 | 0 | 2009-03-24 19:53 |
如何实现gui窗口嵌套 | beulah | MATLAB论坛 | 1 | 2008-12-28 17:57 |
[求助]fslove | lizzy | MATLAB论坛 | 0 | 2008-12-12 18:59 |