Converting FEA data as table into n-D gridded-data Array for Use with 'griddedInterpolant'
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
I have a dataset represented by table obtained from FE Analyses for flux linkage and i want to process this raw data into proper format through MATLAB scripting (as Look up table), where this raw data conaines parametric sweep

I would like to convert this 4-Colomn table into gridded data set in form of 3D Aarry v=(x,y,z), where x,y,z are the first three colomns and the last colomn is v. then i want to process the data with 'griddedInterpolant' to get finer gidded data. The complete dataset provides all of the information needed to create a gridded data set.
채택된 답변
x=unique(t{:,1}); nx=numel(x);
y=unique(t{:,2}); ny=numel(y);
z=unique(t{:,3}); nz=numel(z);
v=permute( reshape(t{:,4},[ny,nx,nz]) ,[2,1,3]);
F=griddedInterpolant({x,y,z}, v)
댓글 수: 8
Thank you for your comment. that is good soluation. i think the usage of griddedInterpolant is unusful sense we interpolate with the same grid data (x,y,z), right? we might define a new grid and then use this function.
i am trying to plot the results but seems not working, do you have an idea?
f1=figure(1);
surf(x, y, squeeze(v(:,:,end)));hold on;
Thank you for your comment. that is good soluation.
You are quite welcome, but please Accept-click the answer with the green button to indicate so.
i think the usage of griddedInterpolant is unusful sense we interpolate with the same grid data (x,y,z), right?
I think you misunderstand. The code I showed you hasn't done any interpolation yet. If you want to upsample v to a finer, grid (for example 2x in all dimensions), you would do,
x=unique(t{:,1}); nx=numel(x);
y=unique(t{:,2}); ny=numel(y);
z=unique(t{:,3}); nz=numel(z);
v=permute( reshape(t{:,4},[ny,nx,nz]) ,[2,1,3]);
F=griddedInterpolant({x,y,z}, v);
X=linspace(min(x), max(x), 2*nx);
Y=linspace(min(y), max(y), 2*ny);
Z=linspace(min(z), max(z), 2*nz);
V=F({X,Y,Z}) %interpolated v
To plot the the k-th slice of this result as a surface, you would do
surf(X,Y,V(:,:,k)')
Thank you Matt. it worked
but i am wondering why you put ny and then nx in the permute function?
i tryied to exchange between x with y and y with z , but did not work, any idea?
i mean something like this:
v=permute( reshape(t{:,4},[nx,ny,nz]) ,[2,1,3]);
or
v=permute( reshape(t{:,4},[nx,ny,nz]) ,[3,2,1]);
any comment Matt?
Your table shows that y is the coordinate that changes most quickly as you move through the data, then x, then z
This is because i applied a Parametric sweep run in FEA, but i tryied not to sort the data according to the first colomon, so that the first colomn 'x coordinate' changes most quickly, rather than y coordinate.
i used this code, and the results are in the figured attached
[~, index] = sort(If);
If = If(index);
IPeak = IPeak(index);
Beta = Beta(index);
Landa_d = Landa_d(index);
t{:,1}=If';
t{:,3}=Beta';
t{:,2}=IPeak';
t{:,4}=Landa_d';

do you think this will still not work?
It will work, but you will need,
v=permute( reshape(t{:,4},[nx,nz,ny]) ,[1,3,2]);
since now the y-coordinate varies the slowest.
You could also just presort with,
t=sortrows(t,[3,2,1]);
v=reshape(t{:,4},[nx,ny,nz]);
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
참고 항목
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
