Calculation errors while using subs and det functions
Show older comments
Hello everybody, i have a 9*9 symbolic matrix and i need to calculate thatof determinant in an interval. I would like to insert a numeric array into symbolic variable and get the determinant values and i want to plot them at the end.
The problems are;
1- when i insert numerical array using "subs" function, then get the numerical expression using the "double" function, then calculate the determinant using the "det" function, there are big calculation errors.
syms beta_sym
beta_ara = [(0.0001:0.0001:0.001)';(0.002:0.001:0.01)';(0.02:0.01:1)';(1:1:20)';(25:5:200)'];
f_beta_num=zeros(length(beta_ara),1);
ddel = besselj(1,beta_sym)*beta_sym^8; %% "ddel" is an expression including
%% bessel & mod. bessel functions and 8th
%% order polynomial of beta_sym and so on
for i = 1:length(beta_ara)
f_beta_num(i) = det(double(subs(ddel,beta_sym,beta_ara(i))));
end
figure(1);clf;
plot(beta_ara,(f_beta_num),'LineWidth',2);hold on;
2- when i use "det" function at the most inner part of the row it takes very long time, thus i don't prefer this alternative.
There must be something missing at the step where it calculates determinant after inserting the numerical value. I guess there must be a row added in order to correct calculation / calculation method.
Following you can see how the plot supposed to be & how it is:

Thanks in advance !
Accepted Answer
More Answers (0)
Categories
Find more on Linear Algebra 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!
