How to plot summation equation
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
how to plot this function with a summation sign? and it should look like this
Respuestas (1)
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.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!