Error using sym/subsindex (line 853) while using symsum

prompt1 = 'Please input a value between 0 and 0.5 for the conductivity parameter (product of the density, thermal conductivity, and specific heat of the rod, kg^(2)s^(-3)K : ';
k = input(prompt1);
prompt2 = 'Please input a time range between 0 and 10 for bar to cool down (s): ';
t_range = input (prompt2);
prompt3 = 'Please input a whole positive value for the number of terms for the series to be calculated over (large values will take longer to run!): ';
m = input (prompt3);
syms n x t;
v(x,t) = (400/(n*pi))*(sin((n*pi*x)/1))*(exp(-k(((n*pi)/1)^2)*t));
u = symsum(v,n,1,m);
fsurf(u, [0 1 0 t_range], 'ShowContours', 'on');
title('Evolution of temperature of bar with time');
xlabel('Length along bar (m)');
ylabel('Time (s)');
zlabel('Temperature (degrees Celcius)');
box on;
The error is produced as a result of the use of symsum on line 10, I also get an error with line 9 and the definition of the function to be used in the sum

 Accepted Answer

Try this solution

2 Comments

Only recently started using MATLAB and only found out you needed asterisks, I obviously missed this one
Thank you for your quick response and for your help :)

Sign in to comment.

More Answers (0)

Asked:

on 2 May 2020

Commented:

on 2 May 2020

Community Treasure Hunt

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

Start Hunting!