Plotting a summation as a function of two variables

1 visualizzazione (ultimi 30 giorni)
Hello, Sorry I'm new to matlab and I couldn't work out the solution to this question with the help.
I'm plotting a function of \theta and \phi as a density plot over the surface of the sphere.
For an easy function f, I had luck using the following code:
res = 50;
lambda = linspace(-pi,pi,res);
theta = linspace(-pi/2,pi/2,ceil(res/2));
[L,T] = meshgrid(lambda,theta);
n=10;
f=(n.*(cos((T-pi/2)/2)).^2+1).*exp(-n.*(sin((T-pi/2)/2).^2));
[X,Y,Z] = sph2cart(L,T,1);
clf;
surf(X,Y,Z,f);
Now I'm trying to do the same but with a more difficult function you can see here
with \mu \nu numbers... We can use a simpler function as a minimal example, like
\sum_{S=0}^{1000} (2S+1) (cos(\theta/2))^2
How can I do to represent this function (of \theta and \phi)over the sphere just like I did with the example below?
Many Thanks

Risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by