How can I extract raw data from a 3D plot generated by PDETool?

9 Ansichten (letzte 30 Tage)
Benjamin Miles
Benjamin Miles am 26 Feb. 2013
Kommentiert: Gergely Marton am 7 Okt. 2017
I'm performing a magnetostatic analysis, I would like the raw data from a plot of magnetic flux density that is generated. However, when I export solution all I get it magnetic potential. I would either appreciate a method of extracting the data form the plot or if it isn't possible then a method for generating the magnetic flux density from the magnetic potential. I cannot figure out how to do it.
Thanks Benji
  1 Kommentar
Evgen Mozok
Evgen Mozok am 21 Okt. 2016
I have the same problem with finding "magnetic flux density". Now I'm trying to manipulate with "p t e u", that I've exported from PDEToolBox, have no result. Can anybody help?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Evgen Mozok
Evgen Mozok am 21 Okt. 2016
Bearbeitet: Evgen Mozok am 21 Okt. 2016
Heh, just add comment that I have no results...and I have some sort of result)
1. Export p,e,t,u from the PDE ToolBox
2. Run script
figure;
pdeplot(p,e,t,'xydata',u, 'colormap','jet','Contour','on');
figure;
[ux,uy] = pdegrad(p,t,u); % Calculate gradient
pdeplot(p,e,t,'xydata',sqrt(ux.^2+uy.^2), 'colormap','jet','Contour','on');
3. Enjoy. I'm not quite shure, but this plots look like PDETool-Plot solution.
  1 Kommentar
Gergely Marton
Gergely Marton am 7 Okt. 2017
The second plot will correctly show you the magnitude of B. In a way your script is right, but for the wrong reasons.
PDE Toolbox in 2D calculates the z component of the magnetic vector potential, and that is what you export in the variable u. The x and y components of the vector potential are zero by definition, see here: https://edoras.sdsu.edu/doc/matlab/toolbox/pde/2examp17.html
The magnetic flux density B is the curl of the magnetic vector potential A, and since Ax==0 and Ay==0, B = (d/Dy(Az), -d/Dx(Az), 0)
Therefore to upgrade your code to show the vector field:
figure; [Adx,Ady] = pdegrad(p,t,u); Bx = Ady; By = -Adx; pdeplot(p,e,t,'FlowData',[Bx;By]);

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by