Coding a First/Second Derivative Test in MATLAB?
2 views (last 30 days)
Show older comments
This is my attempt at coding first/second derivative tests. I seem to be getting nothing out of my if-statement though. Any ideas/help would be greatly appreciated! Thank you all of course in advance
clc; clear; close all;
syms w tsig teps w1 w2
del = atan(w.*(tsig-teps)./(1+(w.^2.*(tsig.*teps))));
w_max = (teps*tsig).^(-1/2);
derv_del = diff(del,w)
derv_del0(w,tsig,teps) = derv_del;
derv_del_wmax = derv_del0(w_max,tsig,teps)
%First Derivative Test
lt(w1,w_max)
gt(w2,w_max)
if (isAlways(gt(derv_del0(w1,tsig,teps),0)) && isAlways(lt(derv_del0(w2,tsig,teps),0)))
disp('del has a maximum at the given w')
end
if (isAlways(lt(derv_del0(w1,tsig,teps),0)) && isAlways(gt(derv_del0(w2,tsig,teps),0)))
disp('del has a minimum at the given w')
end
%Second Derivative Test
derv_del02(w,tsig,teps) = diff(diff(derv_del))
derv_del_wmax2 = derv_del02(w_max,tsig,teps)
if (isAlways(lt(derv_del_wmax2,0)))
disp('del has a maximum at the given w')
end
if (isAlways(gt(derv_del_wmax2,0)))
disp('del has a minimum at the given w')
end
0 Comments
Answers (0)
See Also
Categories
Find more on Genomics and Next Generation Sequencing 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!