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!

 Accepted Answer

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 Comments

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););

Sign in to comment.

More Answers (0)

Categories

Asked:

on 20 Apr 2015

Commented:

on 20 Apr 2015

Community Treasure Hunt

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

Start Hunting!