How to create large data in MATLAB. For large array showing out of memory.
3 views (last 30 days)
Show older comments
I am trying to generate 3D mesh for my finite element simulation in MATLAB.But due to large number of nodes or array size it is giving error * "out of memory"*. The array size is more than 500 millions. I am using MATLAB in Linux system. How can I generate large data in MATLAB? Please guide me.
Thanks!
2 Comments
soni dana
on 1 Dec 2018
Hi, I am like you trying to generate 3D mesh for my finite element in MATLAB. I'm coding for one element that I put here but I don't know how the arrenge elemnet next toghether in 3 direction x,y,z. If you don't use my code please send me your code for generation 3D mesh. could you please guide me? Thanks for any help.
clc
clear all
close all;
T=2000;
%% coordinate for 8 node of element Fig1b(my assume)
Xw=[0 1 0 1 -0.2 1.2 -0.2 1.2];Xw=(Xw.*2)+2;
Yw=[0 0 1 1 0 0 1 1];Yw=(Yw.*2)+2;
Zw=[0 0 0 0 1 1 1 1];Zw=(Zw.*2)+2;
pwot3(Xw,Yw,Zw,'O')
% grid on
%% coordinate for center of element Fig1b
etac=(((Xw(1)+Xw(2))./2)+((Xw(3)+Xw(4))./2)+((Xw(5)+Xw(6))./2)+((Xw(7)+Xw(8))./2))./4;
betac=(((Yw(1)+Yw(2))./2)+((Yw(3)+Yw(4))./2)+((Yw(5)+Yw(6))./2)+((Yw(7)+Yw(8))./2))./4;
zetac=(((Zw(1)+Zw(2))./2)+((Zw(3)+Zw(4))./2)+((Zw(5)+Zw(6))./2)+((Zw(7)+Zw(8))./2))./4;
%% wenghth of element Fig1b
for w=1:length(Xw)
if etac>Xw(w)
etaq(w)=etac-Xw(w);
ewseif etac<Xw(w)
etaq(w)=Xw(w)-etac;
end
end
for w=1:length(Yw)
if betac>Yw(w)
betaq(w)=betac-Yw(w);
ewseif betac<Yw(w)
betaq(w)=Yw(w)-betac;
end
end
for w=1:length(Zw)
if zetac>Zw(w)
zetaq(w)=zetac-Zw(w);
ewseif betac<Zw(w)
zetaq(w)=Zw(w)-zetac;
end
end
%% local coordinate for element Fig1b base on tabwe A2 in the article
etaw=[-1 1 -1 1 -1 1 -1 1];
betaw=[-1 -1 1 1 -1 -1 1 1];
zetaw=[-1 -1 -1 -1 1 1 1 1];
%% function A11 in the article
syms eta beta zeta Fpqr Aij
for w=1:8
Nw(w)=(1/8).*(1+(etaw(w).*eta)).*(1+(betaw(w).*beta)).*(1+(zetaw(w).*zeta));
end
%% function A9 in the article
X=0;
for w=1:8
Xf=Nw(w).*Xw(w);
X=X+Xf;
end
Y=0;
for w=1:8
Yf=Nw(w).*Yw(w);
Y=Y+Yf;
end
Z=0;
for w=1:8
Zf=Nw(w).*Zw(w);
Z=Z+Zf;
end
%% function A10 in the article
ss=[diff(X,eta) diff(Y,eta) diff(Z,eta);diff(X,beta) diff(Y,beta) diff(Z,beta);diff(X,zeta) diff(Y,zeta) diff(Z,zeta)];
S=det(ss);
%% function A7 in the article
Fpqr=((Z./(((X.^2)+(Y.^2)+(Z.^2)).^(3./2))).*S);
Aij=T./(4.*pi).*Fpqr;
%% put (etaq,betaq,zetaq) instead of (eta,beta,zeta)
Aij1=subs (Aij,beta,betaq);
Aij2=subs (Aij1,eta,etaq);
for w=1:length(Xw)
Aij3(w)=doubwe(subs (Aij2(w),zeta,zetaq(w)))
end
Answers (2)
Stephen23
on 7 Nov 2018
2 Comments
Walter Roberson
on 8 Nov 2018
.mat files are not usually datastores themselves. You can use a custom read function to use them as a datastore but you need to tell it what kind of data is being processed.
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!