MATLAB: How to plot the log to base 10 of absolute value of a function containing Sigma (Σ) in 2D

2d plot3d plotsgraphing with matlabplot sum

How can I achieve the 2D-plot with MATLAB?

Best Answer

After many trials, I was able to write the code for the above question.
clear all
close all
Nt = 20;
L = 1;
a = 1;
t = 0:3/(Nt-1):3;
q = 0;
M = 100;
for n= 1:M
an = (2*n-1)/(2*L);
bn = an*pi;
cn = bn^2;
An = 2/(1+a*cn)^2;
xn = exp(-2*cn*t/(1+a*cn));
q = q + An.*xn;
end
P_eta_0 = log10(abs(q));
plot(t,P_eta_0)