Data fiting in Matlab

3 visualizaciones (últimos 30 días)
Saki
Saki el 21 de Abr. de 2024
Movida: Walter Roberson el 21 de Abr. de 2024
Y pluss = (y*Ut)/mu (1)
Upluss = U/Ut (2)
Ypluss=Upluss + exp (-k*B) *(exp(k*Upluss) -1 -k*Upluss + ((k*Upluss).^2)./2 -((k*Upluss).^3)./6 (3)
I have these threee eqautions. in these eqautions, Value of y, U, B, mu and K are known.
How can i find the value of Ut by usind data fiting of the 3rd equation?

Respuesta aceptada

Walter Roberson
Walter Roberson el 21 de Abr. de 2024
Movida: Walter Roberson el 21 de Abr. de 2024
You have a missing ) in Ypluss . I had to guess about where it goes.
y_data = %...
U_data = %...
B_data = %...
mu_data = %...
k_data = %...
n = size(y_data, 1);
syms y [n 1]
syms U [n 1]
syms B [n 1]
syms mu [n 1]
syms k [n 1]
syms Ut
Ypluss = (y*Ut)./mu
Ypluss = 
Upluss = U./Ut
Upluss = 
eqn = Ypluss == Upluss + exp(-k .* B) .* (exp(k .* Upluss) - 1) - k .* Upluss + ((k .* Upluss).^2)./2 -((k .* Upluss).^3)./6
eqn = 
residue = sum((rhs(eqn) - lhs(eqn)).^2)
residue = 
fun = matlabFunction(residue, 'Vars', {Ut, y, U, B, mu, k})
fun = function_handle with value:
@(Ut,in2,in3,in4,in5,in6)(in3(1,:)./Ut+exp(-in4(1,:).*in6(1,:)).*(exp((in3(1,:).*in6(1,:))./Ut)-1.0)+(in3(1,:).^2.*1.0./Ut.^2.*in6(1,:).^2)./2.0-(in3(1,:).^3.*1.0./Ut.^3.*in6(1,:).^3)./6.0-(in3(1,:).*in6(1,:))./Ut-(Ut.*in2(1,:))./in5(1,:)).^2+(in3(2,:)./Ut+exp(-in4(2,:).*in6(2,:)).*(exp((in3(2,:).*in6(2,:))./Ut)-1.0)+(in3(2,:).^2.*1.0./Ut.^2.*in6(2,:).^2)./2.0-(in3(2,:).^3.*1.0./Ut.^3.*in6(2,:).^3)./6.0-(in3(2,:).*in6(2,:))./Ut-(Ut.*in2(2,:))./in5(2,:)).^2+(in3(3,:)./Ut+exp(-in4(3,:).*in6(3,:)).*(exp((in3(3,:).*in6(3,:))./Ut)-1.0)+(in3(3,:).^2.*1.0./Ut.^2.*in6(3,:).^2)./2.0-(in3(3,:).^3.*1.0./Ut.^3.*in6(3,:).^3)./6.0-(in3(3,:).*in6(3,:))./Ut-(Ut.*in2(3,:))./in5(3,:)).^2+(in3(4,:)./Ut+exp(-in4(4,:).*in6(4,:)).*(exp((in3(4,:).*in6(4,:))./Ut)-1.0)+(in3(4,:).^2.*1.0./Ut.^2.*in6(4,:).^2)./2.0-(in3(4,:).^3.*1.0./Ut.^3.*in6(4,:).^3)./6.0-(in3(4,:).*in6(4,:))./Ut-(Ut.*in2(4,:))./in5(4,:)).^2+(in3(5,:)./Ut+exp(-in4(5,:).*in6(5,:)).*(exp((in3(5,:).*in6(5,:))./Ut)-1.0)+(in3(5,:).^2.*1.0./Ut.^2.*in6(5,:).^2)./2.0-(in3(5,:).^3.*1.0./Ut.^3.*in6(5,:).^3)./6.0-(in3(5,:).*in6(5,:))./Ut-(Ut.*in2(5,:))./in5(5,:)).^2+(in3(6,:)./Ut+exp(-in4(6,:).*in6(6,:)).*(exp((in3(6,:).*in6(6,:))./Ut)-1.0)+(in3(6,:).^2.*1.0./Ut.^2.*in6(6,:).^2)./2.0-(in3(6,:).^3.*1.0./Ut.^3.*in6(6,:).^3)./6.0-(in3(6,:).*in6(6,:))./Ut-(Ut.*in2(6,:))./in5(6,:)).^2+(in3(7,:)./Ut+exp(-in4(7,:).*in6(7,:)).*(exp((in3(7,:).*in6(7,:))./Ut)-1.0)+(in3(7,:).^2.*1.0./Ut.^2.*in6(7,:).^2)./2.0-(in3(7,:).^3.*1.0./Ut.^3.*in6(7,:).^3)./6.0-(in3(7,:).*in6(7,:))./Ut-(Ut.*in2(7,:))./in5(7,:)).^2+(in3(8,:)./Ut+exp(-in4(8,:).*in6(8,:)).*(exp((in3(8,:).*in6(8,:))./Ut)-1.0)+(in3(8,:).^2.*1.0./Ut.^2.*in6(8,:).^2)./2.0-(in3(8,:).^3.*1.0./Ut.^3.*in6(8,:).^3)./6.0-(in3(8,:).*in6(8,:))./Ut-(Ut.*in2(8,:))./in5(8,:)).^2+(in3(9,:)./Ut+exp(-in4(9,:).*in6(9,:)).*(exp((in3(9,:).*in6(9,:))./Ut)-1.0)+(in3(9,:).^2.*1.0./Ut.^2.*in6(9,:).^2)./2.0-(in3(9,:).^3.*1.0./Ut.^3.*in6(9,:).^3)./6.0-(in3(9,:).*in6(9,:))./Ut-(Ut.*in2(9,:))./in5(9,:)).^2+(in3(10,:)./Ut+exp(-in4(10,:).*in6(10,:)).*(exp((in3(10,:).*in6(10,:))./Ut)-1.0)+(in3(10,:).^2.*1.0./Ut.^2.*in6(10,:).^2)./2.0-(in3(10,:).^3.*1.0./Ut.^3.*in6(10,:).^3)./6.0-(in3(10,:).*in6(10,:))./Ut-(Ut.*in2(10,:))./in5(10,:)).^2+(in3(11,:)./Ut+exp(-in4(11,:).*in6(11,:)).*(exp((in3(11,:).*in6(11,:))./Ut)-1.0)+(in3(11,:).^2.*1.0./Ut.^2.*in6(11,:).^2)./2.0-(in3(11,:).^3.*1.0./Ut.^3.*in6(11,:).^3)./6.0-(in3(11,:).*in6(11,:))./Ut-(Ut.*in2(11,:))./in5(11,:)).^2+(in3(12,:)./Ut+exp(-in4(12,:).*in6(12,:)).*(exp((in3(12,:).*in6(12,:))./Ut)-1.0)+(in3(12,:).^2.*1.0./Ut.^2.*in6(12,:).^2)./2.0-(in3(12,:).^3.*1.0./Ut.^3.*in6(12,:).^3)./6.0-(in3(12,:).*in6(12,:))./Ut-(Ut.*in2(12,:))./in5(12,:)).^2+(in3(13,:)./Ut+exp(-in4(13,:).*in6(13,:)).*(exp((in3(13,:).*in6(13,:))./Ut)-1.0)+(in3(13,:).^2.*1.0./Ut.^2.*in6(13,:).^2)./2.0-(in3(13,:).^3.*1.0./Ut.^3.*in6(13,:).^3)./6.0-(in3(13,:).*in6(13,:))./Ut-(Ut.*in2(13,:))./in5(13,:)).^2+(in3(14,:)./Ut+exp(-in4(14,:).*in6(14,:)).*(exp((in3(14,:).*in6(14,:))./Ut)-1.0)+(in3(14,:).^2.*1.0./Ut.^2.*in6(14,:).^2)./2.0-(in3(14,:).^3.*1.0./Ut.^3.*in6(14,:).^3)./6.0-(in3(14,:).*in6(14,:))./Ut-(Ut.*in2(14,:))./in5(14,:)).^2+(in3(15,:)./Ut+exp(-in4(15,:).*in6(15,:)).*(exp((in3(15,:).*in6(15,:))./Ut)-1.0)+(in3(15,:).^2.*1.0./Ut.^2.*in6(15,:).^2)./2.0-(in3(15,:).^3.*1.0./Ut.^3.*in6(15,:).^3)./6.0-(in3(15,:).*in6(15,:))./Ut-(Ut.*in2(15,:))./in5(15,:)).^2+(in3(16,:)./Ut+exp(-in4(16,:).*in6(16,:)).*(exp((in3(16,:).*in6(16,:))./Ut)-1.0)+(in3(16,:).^2.*1.0./Ut.^2.*in6(16,:).^2)./2.0-(in3(16,:).^3.*1.0./Ut.^3.*in6(16,:).^3)./6.0-(in3(16,:).*in6(16,:))./Ut-(Ut.*in2(16,:))./in5(16,:)).^2+(in3(17,:)./Ut+exp(-in4(17,:).*in6(17,:)).*(exp((in3(17,:).*in6(17,:))./Ut)-1.0)+(in3(17,:).^2.*1.0./Ut.^2.*in6(17,:).^2)./2.0-(in3(17,:).^3.*1.0./Ut.^3.*in6(17,:).^3)./6.0-(in3(17,:).*in6(17,:))./Ut-(Ut.*in2(17,:))./in5(17,:)).^2+(in3(18,:)./Ut+exp(-in4(18,:).*in6(18,:)).*(exp((in3(18,:).*in6(18,:))./Ut)-1.0)+(in3(18,:).^2.*1.0./Ut.^2.*in6(18,:).^2)./2.0-(in3(18,:).^3.*1.0./Ut.^3.*in6(18,:).^3)./6.0-(in3(18,:).*in6(18,:))./Ut-(Ut.*in2(18,:))./in5(18,:)).^2+(in3(19,:)./Ut+exp(-in4(19,:).*in6(19,:)).*(exp((in3(19,:).*in6(19,:))./Ut)-1.0)+(in3(19,:).^2.*1.0./Ut.^2.*in6(19,:).^2)./2.0-(in3(19,:).^3.*1.0./Ut.^3.*in6(19,:).^3)./6.0-(in3(19,:).*in6(19,:))./Ut-(Ut.*in2(19,:))./in5(19,:)).^2+(in3(20,:)./Ut+exp(-in4(20,:).*in6(20,:)).*(exp((in3(20,:).*in6(20,:))./Ut)-1.0)+(in3(20,:).^2.*1.0./Ut.^2.*in6(20,:).^2)./2.0-(in3(20,:).^3.*1.0./Ut.^3.*in6(20,:).^3)./6.0-(in3(20,:).*in6(20,:))./Ut-(Ut.*in2(20,:))./in5(20,:)).^2
Ut0 = rand();
best_Ut = fminsearch( @(Ut)fun(Ut, y_data, U_data, B_data, mu_data, k_data), Ut0)

Más respuestas (0)

Categorías

Más información sobre Optimization en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by