MATLAB Answers


How do I create a 3D plot in MuPAD using a solution exported from the PDE toolbox?

Asked by Jeremy Pearson on 16 Nov 2012

I have a cylyndrical sample with variable nuetron flux throughout. I was able to sove for flux as a function of r and z in the pde toolbox, u(r,z).

I pressed export mesh and export solution.

I was able to solve for u at any r and z in the command window by entering the code:

>> F = TriScatteredInterp(p(1,:)', p(2,:)', u);

I can also visualize the flux profile from r = 0 to r = R at any z and plot it with the following code:

>> x = linspace(0,0.5,25);

>> y = linspace(0.9,0.9,25);

>> F = TriScatteredInterp(p(1,:)', p(2,:)', u);

>> uxy = F(x,y);

>> figure; plot(x, uxy);

You can see I am trying to visualize how flux varies with r at a defined z. I want to take such a plot (which looks like a parabola) and rotate it around the z-axis to create a 3D plot of a cross section of the cylinder.

It appears that this is done in MuPAD using plot::ZRotate

How can I create this rotated plot in MuPAD using plot::ZRotate? Is MuPAD able to access equations from the command window or exported solutions from PDEtoolbox? If so, part of my hang up may be figuring out how to properly define equations with two independent variables with plot::ZRotate.



Edit - Another approach would be to to use plot::Cylindrical in MuPAD, I entered:

plot(plot::Cylindrical([r, phi, F(r,0.9)], r = 0..0.5, phi = 0..2*PI))

But still here, MuPAD doesn't recognize F(r,0.9) so I'm entering it incorrectly or MuPAD is not linked to the command window.


Log in to comment.

0 Answers

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today