I'm trying to make a surface 3d plot of this code. But i keep getting just the figure?

1 view (last 30 days)
Here is my code so far:
theta= 0:2*pi
ra=1
r=0:ra
x=r*cos(theta)
y=r*sin(theta)
z=sqrt(ra^2-x^2-y^2)
surf(x,y,z,'r')
axis equal
title('Spherical')

Accepted Answer

Jan
Jan on 7 Feb 2016
I do not get an empty figure, but an arror message:
Error using *
Inner matrix dimensions must agree.
In the line "x=r*cos(theta)" r and theta are vectors of different sizes, such that a multiplication is not defined. Without knowing what you watn to achieve, a suggestion would be wild guessing only.

More Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!