set first derivative equal to zero with some constant
16 vues (au cours des 30 derniers jours)
I have equation from derive from snellius law and i'd like to set its derivative equal to zero since fermat principle said so.
here the matlab that I used to get fist derivative, but when I solve it in order to get x value when dT/dt=0 it give me strange result. Is it because I put a lot of variable in syms? actually a, b, c, v1 and v2 is a constant. should I put it a number rather than a alphabet symbol to get proper result?
syms x a b c v1 v2
Matt J le 14 Mai 2023
Modifié(e) : Matt J le 14 Mai 2023
should I put it a number rather than a alphabet symbol to get proper result?
You should just use fzero The symbolic solutions for x are very messy.
[a, b, c, v1, v2]=deal(1);
fun=@(x) x./sqrt(x.^2+a.^2)./v1 -(b-x)./sqrt((b-x).^2+c.^2)./v2;
x = fzero(fun,1)
fplot(fun,[-5 ,5]); yline(0); xline(x)