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 allclose allNt = 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;endP_eta_0 = log10(abs(q));plot(t,P_eta_0) Related SolutionsMATLAB: How to plot the log to base 10 of absolute value of a function containing Sigma (Σ) Try this code, it might help.clear allclose allNt = 100;Nx = 150;L = 2;a = .5;t = 0:4/(Nt-1):4;x = 0:L/(Nx-1):L;[t,x] = meshgrid(t,x);q = zeros(Nt,Nx);M = 500;for n = 1:M an = (2*n-1)/(2*L); bn = an*pi; cn = bn^2; An = (-1)^n/(1+a*cn); xn = exp(-cn*t/(1+a*cn)); yn = sin(bn*x); q = q + An*yn'.*xn';endqabs = log10(abs(q));surf(t',x',qabs)colormap('winter')xlabel('t');ylabel('x');zlabel('10log|q|') MATLAB: How to calculate this sym of serie Try this intuitive, brute force method:clc;% Sample numbers:q = 10;n = 3;theSum = 0;for k = 0 : n qArray = q : -1 : q-k; p = prod(qArray) theSum = theSum + p;end% Print to command windowtheSum Related QuestionHow to write Continue Long Statements on Multiple LinesMultiple graphs for two or more functions for different values in different colorDear friends, the long matlab command that I have written is error. I want to be spelled the same way but without error.
Best Answer