How to plot summation equation
Show older comments
how to plot this function with a summation sign? and it should look like this

1 Comment
KALYAN ACHARJYA
on 4 Dec 2020
Answers (1)
KSSV
on 4 Dec 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.
Categories
Find more on Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!