How to plot summation equation
Afficher commentaires plus anciens
how to plot this function with a summation sign? and it should look like this

Réponses (1)
KSSV
le 4 Déc 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.
Catégories
En savoir plus sur Line Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!