How to plot the log to base 10 of absolute value of a function containing Sigma (Σ)

1 回表示 (過去 30 日間)
How can I do this plot in MATLAB?

採用された回答

Abraham Boayue
Abraham Boayue 2018 年 5 月 22 日
編集済み: Abraham Boayue 2018 年 5 月 22 日
Try this code, it might help.
clear all
close all
Nt = 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';
end
qabs = log10(abs(q));
surf(t',x',qabs)
colormap('winter')
xlabel('t');
ylabel('x');
zlabel('10log|q|')
  2 件のコメント
Micheal oguntola
Micheal oguntola 2018 年 5 月 22 日
@Abraham, after making a little amendment to the code you provided, I was able to produce the plot. Thank you so much for your help. I still have one more question to ask
Abraham Boayue
Abraham Boayue 2018 年 5 月 22 日
You are welcome Michael. What is your question?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by