How can I generate a rotationally invariant surface from a profile?

I have a vector, e.g. V = [1 2 3 4 3 2 1], that represents a profile through the center of a rotationally invariant surface. I'm trying to generate a matrix representing the surface.
Alternatively, if there's a spherical cap but all I have is a profile from one edge, through the center, how can I generate the spherical cap from the profile?
Thanks in advance for any help!

 Risposta accettata

Matt J
Matt J il 20 Apr 2015
Modificato: Matt J il 20 Apr 2015
Something like this, maybe
radius=length(V)-1;
[X,Y]=ndgrid(linspace(0,radius,100););
R=sqrt(X.^2+Y.^2);
surfaceSamples=interp1(0:radius,V,R(:));
surfaceSamples=reshape(surfaceSamples,size(X));
surf(X,Y,surfaceSamples);

3 Commenti

Wow Matt! Thanks!
It solves it except that the code produces just one quadrant of the entire surface. I can try to tweak the code but something tells me you'd do it in 1/1000th the time it'd take me.
This line controls the region sampled. Going from -radius to radius should include all quadrants.
[X,Y]=ndgrid(linspace(-radius,radius,100););
Much appreciated Matt!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Mathematics in Centro assistenza e File Exchange

Richiesto:

il 20 Apr 2015

Commentato:

il 20 Apr 2015

Community Treasure Hunt

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

Start Hunting!

Translated by