필터 지우기
필터 지우기

Unable to plot 3d surface of a symbolic expression involving indefinite integral and summations

조회 수: 2 (최근 30일)
I was trying to plot the 3d surface of the following function from a paper on theoretical physics.
function
I have tried to use symbolic expressions, but was unsuccessfull in doing that.
After running my code (given below) Matlab is showing busy and does not stop. When I try to terminate the execution by ctrl+c, it says
% Operation terminated by user during sym/int (line 135)
Here is my code.
syms alpha t f fi sum_index1 sum_index2;
cerenkov = 1.117;
c = 3 * 10^8;
b = 5 * 10^8;
m = 40;
q = m .*((sin(cerenkov)).^2);
p = m - q;
f1(f) = (exp(f-0.5).^2); %Expression for S(f)
f2(f,alpha) = ((2.*pi.*f.*b.*sin(alpha))/(c.*m.*cos(cerenkov))); %expression for phi(f, alpha)
sum_1(sum_index1, f, alpha) = sum_index1*(q/p)*cos(sum_index1*f2(f,alpha));
sum_2(sum_index2, f, alpha) = (m - sum_index2)*cos(sum_index2*f2(f,alpha));
S_symsum_1(f, alpha) = symsum(sum_1(sum_index1, f, alpha), sum_index1, 1, ceil(p));
S_symsum_2(f, alpha) = symsum(sum_2(sum_index2, f, alpha), sum_index2, ceil(p)+1, m);
expr(f,t,alpha) = f1(f).*(S_symsum_1(f, alpha) + S_symsum_2(f, alpha)).*cos(2.*pi.*f2(f,alpha).*t);
final_expression(t, alpha) = int(expr(f,t,alpha), f);
fsurfe(final_expression(t, alpha))
Thanks ahead for any help, and sorry if the question is not properly formatted. This is my first question on this platform.

답변 (1개)

SAI SRUJAN
SAI SRUJAN 2024년 2월 1일
Hi Edgar,
I understand that you are trying to plot 3D surface of a symbolic expression involving indefinite integral summations.
The code you provided is not working because the 'fsurfe' function is not a valid MATLAB function. It seems like you are trying to call a function that does not exist in MATLAB. If you are trying to plot the final expression, you can use the 'fplot' or 'fsurf' function instead.
We can see that the 'final_expression' is very complex and very long range equation. When dealing with symbolic expressions in MATLAB, especially when they involve indefinite integrals and summations, the computations can become very complex and time-consuming.
To simplify symbolic expressions in MATLAB for easy integration, you can use the 'simplify' function which is a part of the Symbolic Math Toolbox. The 'simplify' function attempts to rewrite an expression in a simpler form. After simplifying, you can use the 'integrate' or 'int' function to perform the integration.
Please refer to the following code outline to proceed further,
syms x
expr = sin(x)^2 * cos(x);
% Simplify the expression
simplifiedExpr = simplify(expr);
integralResult = int(simplifiedExpr, x);
disp(integralResult);
For a comprehensive understanding of the 'simplify' function in MATLAB, please refer to the following documentation.
I hope this helps!

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by