How to use function like syms - solve to be executed for each data?

1 view (last 30 days)
Hi Community,
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
0.2709
0.2891
0.3008
0.3049
0.3010
0.2895
0.2715
0.2488
0.2232
0.1966
0.1705
0.1459
0.1238
0.1043
0.0877
0.0739]
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
end
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....

Answers (0)

Categories

Find more on Earth, Ocean, and Atmospheric Sciences 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!