127 views (last 30 days)

Star Strider
on 18 Jan 2020

I assume ‘complex’ just means complicated, and not a function with real an imaginary arguments or output. If it is actually complex in the mathematical sense, a slightly different procedure than that presented here would be necessary.

Try something like this:

theta = linspace(0, pi, 50);

g = linspace(0, 100, 50);

[Th,G] = ndgrid(theta, g);

F = f(Th,G);

figure

mesh(Th, G, F)

grid on

Make appropriate changes to get the result you want.

Star Strider
on 18 Jan 2020

I am not following what you’re doing in your code.

The result needs to be a function of θ andg. Then you can use the techniques I described to plot it.

Walter Roberson
on 19 Jan 2020

What result are you expecting for theta = 0 leading to division by sin(0)?

Walter Roberson
on 19 Jan 2020

%% Now I need to perform that integration of phi and make a 3d plot of that result with

theta and alpha , aplha is a real integer runs from 0 to ...and theta from 0 to pi.

The integration of phi? But phi is one of your input variables, not an output formula.

Which of your formulas is to be integrated with respect to what? What should be a long the two independent axes? As you indicate that alpha is an integer, it sounds as if alpha is not one of your independent variables.

Your r is complex valued. Are you looking to plot the real or the imaginary part or are you looking to plot the absolute value?

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 2 Comments

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/500898-3d-plotting-in-matlab#comment_789301

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/500898-3d-plotting-in-matlab#comment_789301

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/500898-3d-plotting-in-matlab#comment_789340

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/500898-3d-plotting-in-matlab#comment_789340

Sign in to comment.