How to use function like syms - solve to be executed for each data?
1 view (last 30 days)
I want to ask... How to create a solve function to be adapted for each data of mine? I have this code :
syms a b h x u d;
Gz = [0.2480
G = 6.67428e-11; %Gravity Contant
G_1 = 4*pi*G/3;
ruas_akhir1 = expand(b^3*h*((x^2 + h^2)^(-3/2)));
ruas_akhir = (b^6*h^8 + 3*b^6*h^6*x^2 + 3*b^6*h^4*x^4 + b^6*h^2*x^6)^(1/2);% Last Part Formula for gravity
ruas_akhir_kuadrat = b^6*h^8 + 3*b^6*h^6*x^2 + 3*b^6*h^4*x^4 + b^6*h^2*x^6;
p = 1442 - d;
p_G1 = G_1*p;
kernel = p_G1*ruas_akhir;
kernel_fix = u*((2.7957e-10*d)-(4.0314e-07));
expand_kernel = expand(kernel_fix);
hasil_kernel = (2.7957e-10*d*u) - (4.0314e-07*u);
for Gz = Gz(:)
u_solve = solve(hasil_kernel==Gz,u); % I want to execte solve function for each data of Gz
the u_solve variable should be a series of solve result from each of Gz data.... But the ouput is only 1 and its an empty :
Empty sym: 0-by-1
Iam just in vain using the for statement like that. Would u mind to help me out?
Thank you very much, everyone....