Plot implicit function with the summation inside

3 次查看(过去 30 天)
Hello.
I'm trying to plot an implicit trancendental function with the summation inside the expression. Here my code:
function z=mu_ring
t=0.25;
G=0.0;
n=1:10000;
z1=@(w_c,mu) 1+w_c/pi*sum((-1).^n/n.*2*pi^2*n.*t./w_c*1./sinh(2*pi^2*n*t./w_c).*sin(2*pi*n*mu./w_c).*cos(pi*n).*exp(-2*pi*n.*G./w_c))-mu;
fimplicit(z1,[0.01 10 0 10],'MeshDensity',100,'LineWidth',3,'Color','red')
set(gca,'FontName','Times New Roman','FontSize',34)
xlabel('w_c','FontName','Times New Roman','fontsize',34,'fontweight','b');
ylabel('\mu','FontName','Times New Roman','fontsize',34,'fontweight','b');
grid on
end
After the execution I got a horizontal line with mu=1 instead something like that
Thank you in advance.

回答(1 个)

Peng Li
Peng Li 2020-3-28
z1 = @(w_c, mu) 1 + w_c / pi ...
* sum((-1).^n / n .* 2 * pi^2 * n .* t ... % are you sure that the first / and the second to last * here correct or they should be ./ and .*?
./ w_c ...
* 1 ./ sinh(2 * pi^2 * n * t ./ w_c) ...
.* sin(2*pi*n*mu ./ w_c) ...
.* cos(pi*n) ...
.* exp(-2*pi*n.*G ./ w_c)) ...
- mu;
might be easier to read if you improve your style a bit.

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by