Plotting an equation with multiple Summation in it
5 次查看(过去 30 天)
显示 更早的评论
I want to Plot this function based on i
this is what I wrote in code:
the numbers in the picture are the results of calculation of some variables like E*A ,...
But I get this Error: Check for incorrect argument data type or missing argument in call to function 'symsum'.
A= 0.00001136;
E=5.5;
Fs=20.;
H=2.9;
n=67.;
f=((((Fs-E*A*symsum((sqrt(H^2+0.00576^2*i^2)/H)^2-(sqrt(H^2+0.00576^2*i^2)/H),i,1,n) +symsum((sqrt(H^2+0.00576^2*j^2)/H)^2-(sqrt(H^2+0.00576^2*j^2)/H),j,1,n))*m_i)/( symsum((sqrt(H^2+0.00576^2*k^2)/H)^2,k,0,n)+symsum((sqrt(H^2+0.00576^2*l^2)/H)^2,l,0,n)-1))+E*A*((sqrt(H^2+0.00576^2*i^2)/H)-1));
plot(i,f);
0 个评论
回答(1 个)
Raghava S N
2024-11-20,9:37
As I understand, you are trying to plot the equation attached in the figure, upon finding “f” as a function of “i”, but the function “symsum” is throwing an error.
The summation index in each of the equations must be declared as symbolic variables as stated in the documentation of the “symsum” function below- https://www.mathworks.com/help/symbolic/sym.symsum.html#btydjwt-k:~:text=%E2%80%94%20Summation%20index-,symbolic%20variable,-a%20%E2%80%94%20Lower.
This can be done using the “syms” command, which is used to create symbolic scalar variables and functions. For more details about “syms”, refer to this link - https://www.mathworks.com/help/symbolic/syms.html. Hence, in the code, before declaring the equation, include the following command
syms i j k l
The equation “f” is a polynomial with “i” as the variable, hence it can be declared as a symbolic function, so that it can be evaluated at different values of “i”. Refer to this documentation link which explains how to create and evaluate symbolic functions - https://www.mathworks.com/help/symbolic/syms.html#buoeaym-1:~:text=Create%20symbolic%20functions%20with%20one%20and%20two%20arguments.
Hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!