How to plot summation equation

7 visualizaciones (últimos 30 días)
vic
vic el 4 de Dic. de 2020
Respondida: KSSV el 4 de Dic. de 2020
how to plot this function with a summation sign? and it should look like this

Respuestas (1)

KSSV
KSSV el 4 de Dic. de 2020
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.

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by