How to plot summation equation

回答(1 个)

You need to proceed like below:
n = 1000 ; % you can change it if you want
% define your constant values below
k = 1 ;
t = 1 ;
l = 1 ;
Ss = 10 ;
hl = 5 ;
% Make n a vecor
n = 1:n ;
% Given function
h = @(x,t) 2/pi*hl./n.*sin(n*pi*x/l).*(1-exp(-k*n.^2*pi^2*t/(Ss*l^2))) ;
x = 0:0.5:1 ; % possible x values
p = zeros(size(x)) ; % save the sum for eac function
for i = 1:length(x)
v = h(x(i),t) ;
p(i) = sum(v) ;
end
plot(x,p)
Check the code thoroughly...the above can also be obtained without loop. You need to run a loop for t.

类别

帮助中心File Exchange 中查找有关 Graphics Objects 的更多信息

提问:

vic
2020-12-4

回答:

2020-12-4

Community Treasure Hunt

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

Start Hunting!

Translated by