need suggestion to calculate alpha value in semi-infinite experimental results
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I wanted to solve for alpha by using experimental data for different time, the1, and the2.
Please suggest how to go ahead.
alpha=sym('alpha',[1 1467]);
eqn = (2*5761.11)*time.^0.5*(alpha).^0.5./(the1*pi^0.5)*exp((-x1^2)./(4*time.*alpha))-(5761.11*x1)./the1*(1-(2/sqrt(pi))*(x1./(2*sqrt(time.*alpha))-((x1./(2*sqrt(time.*alpha)))^3)/3))== (2*5761.11)*time.^0.5*(alpha).^0.5./(the2*pi^0.5)*exp((-x2^2)./(4*time.*alpha))-(5761.11*x2)./the2*(1-(2/sqrt(pi))*(x2./(2*sqrt(time.*alpha))-((x2./(2*sqrt(time.*alpha)))^3)/3));
Alpha = solve(eqn,alpha);
10 commentaires
Rik
le 14 Mar 2022
Now you have code that works, but no longer contains your variables. Why did you do that? Now you have to go in and change that 6000 to the value of time, instead of changing the value of time.
You need to write code that runs in the online environment (use the green arrow) and that depends on your variables. You're almost there.
Réponses (1)
Sandeep
le 26 Sep 2023
Hi Akshay,
It is my understanding that you are expecting an approach to solve for alpha using experimental data for different times (time), the1, and the2 which can be semi-infinite in number. You can follow these steps as an approach for the solution,
- Define the symbolic variable alpha using the sym function.
- Set up the equation (eqn) that relates alpha to the experimental data. Make sure to replace the variables in the equation with their corresponding values.
- Solve the equation (eqn) to find the values of alpha that satisfy the equation. The variable Alpha will contain the solutions for alpha based on the experimental data provided.
Please refer to the sample implementation given below,
function Alpha = solveAlpha(time_values, the1_values, the2_values)
syms alpha
Alpha = zeros(length(time_values), length(the1_values)); % Preallocate array to store results
for i = 1:length(time_values)
for j = 1:length(the1_values)
eqn = (2 * 5761.11) * time_values(i)^0.5 * (alpha)^0.5 / (the1_values(j) * pi^0.5) * exp((-x1^2) / (4 * time_values(i) * alpha)) - (5761.11 * x1) / the1_values(j) * (1 - (2 / sqrt(pi)) * (x1 / (2 * sqrt(time_values(i) * alpha)) - ((x1 / (2 * sqrt(time_values(i) * alpha)))^3) / 3)) == (2 * 5761.11) * time_values(i)^0.5 * (alpha)^0.5 / (the2_values(j) * pi^0.5) * exp((-x2^2) / (4 * time_values(i) * alpha)) - (5761.11 * x2) / the2_values(j) * (1 - (2 / sqrt(pi)) * (x2 / (2 * sqrt(time_values(i) * alpha)) - ((x2 / (2 * sqrt(time_values(i) * alpha)))^3) / 3));
solutions = solve(eqn, alpha);
Alpha(i, j) = double(solutions);
end
end
end
Make sure to replace x1 and x2 with the actual values you have for the variables. The nested loops will iterate over each combination of time, the1, and the2 values, solve the equation, and store the corresponding values of alpha in the Alpha matrix.
Hope you find it helpful.
Sandeep BS
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!