Problem in displaying slice and contourslice plot
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
When i assign some value to a particular plane in a 3d matrix, Matlab automatically averages top and bottom plane shows some value as if it has been assigned programmically. Will that affect simulation??
Given the code below:
e=ones(10,10,10);
e(:,:,8)=5;
slice(e,[],[],7:0.5:9);
If we execute the above code, it shows some values at z=7.5 and z=8.5 where there is no definition !! Is there a solution to avoid all these averaging in slice plot and contourslice plot
0 Commenti
Risposte (1)
Walter Roberson
il 7 Nov 2015
... Don't ask it to display at positions where there is no data?
slice(e,[],[],7:1:9)
3 Commenti
Walter Roberson
il 7 Nov 2015
Look at the documentation for slice() again:
slice(...,'method') specifies the interpolation method. 'method' is 'linear', 'cubic', or 'nearest'.
linear specifies trilinear interpolation (the default).
cubic specifies tricubic interpolation.
nearest specifies nearest-neighbor interpolation.
Notice the default of 'linear'. Therefore if you ask for data at coordinates which are not exactly in the X, Y, Z input coordinates given (or inferred) then the data is going to be interpolated from the known data. This is a primary function of slice(). If you do not want interpolation then do not ask to draw at coordinates that do not exist in the input.
"if some further parameters are calculated" -- are calculated by what?
"will it affect simulation" -- No, not unless you are reading the data out of the graphic and using it to compute with. slice() is for producing graphics, not for extracting data for computation purposes.
If your purpose is to extract data for calculation purposes, then just index the data:
extracted_data = e(:,:,7:9);
Vedere anche
Categorie
Scopri di più su Interpolation of 2-D Selections in 3-D Grids in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!