How to display symbolic function as written/coded

12 views (last 30 days)
Hello, I am trying to symbolicly represent an equation used for a Davidenko numerical analysis method as described by (8).
Fairly new to using symbolic math with MATLAB so bare with me please. When I try to declare and display the above equation symbolicly and display the results with the following code:
syms n k cn Te ds cs ws %Defining symbolic representation optical parameters (refractive index "n", and exinction coefficient "k"
T10 = ( (4.*cn)./((cn + 1).^2) ); %Fresnel Transmission coefficient between sample and air
WP = ( exp(1j.*(cn - 1).*(ws*ds/cs)) ); %Wave propagation function through sample with thickness "d" in frequency domain "w"
denom = ( 1 - ( exp(2j.*cn.*(ws*ds/cs)).*((cn - 1)./(cn + 1)).^2 ) ); %Fabry-Perot reflection within sample
num = T10*WP;
f = Te - ( (num)/(denom) ); %This is f(w,cn) with constants "ds", "cs" (speed of light)
disp('Symbolic representation of equ(8) from Fastampa');
Symbolic representation of equ(8) from Fastampa
disp(f); %To test if equation rouglhy looks like that of literature
The result outputed what I interpret as equation (8) but with a common denominator for everything to the right of Texp(w):
I would like my symbolic equation output to not be "expanded" (i.e., have a common denominator) as it makes things easier to follow later on when I manipulate the equation further to take the derivative with respect to cn.
Is there a function or argument I am missing to ensure MATLAB does not change the symbolic equation as I have declared it?
I appreciate any insight :)
  3 Comments
Walter Roberson
Walter Roberson on 5 Aug 2022
The internal symbolic engine has ways of preventing operations from being carried out. Unfortunately, if you return that version of an expression to the MATLAB level, then MATLAB will reset the symbolic engine if you ask to display that version.
Camille
Camille on 5 Aug 2022
Thank you both for the clarification! I know and understand what MATLAB displays is equivalent to what I see in literature and declare :)

Sign in to comment.

Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!