I cannot integrate after the summation inside the FOR loop. I want to integrate with respect to x.
1 view (last 30 days)
Show older comments
clear all;
%syms x tau y;
Bn=[0.535 1.02 1.488 1.955 2.439 3.509 3.996 4.464];
T_inf=15;
To=20;
t=200;
G_11=0;
G_12=0;
G_21=0;
G_22=0;
theta_1=1;
G_110=0;
for i=1:1:8
A_1n(i) = 1;
B_1n(i) = -2369.123*Bn(1,i);
A_2n(i) = sin(2.4618*Bn(1,i))*(sin(1.048*Bn(1,i))-2369.123*Bn(1,i)*cos(1.048*Bn(1,i)))+1.6678*(cos(1.048*Bn(1,i))-2369.123*Bn(1,i)*sin(1.048*Bn(1,i)))*cos(2.4618*Bn(1,i));
B_2n(i) = -sin(2.4618*Bn(1,i))*(1.6678*cos(1.048*Bn(1,i))-3951.2245*Bn(1,i)*sin(1.048*Bn(1,i)))+cos(2.4618*Bn(1,i))*(sin(1.048*Bn(1,i))-2369.123*Bn(1,i)*cos(1.048*Bn(1,i)));
si_1ns = @(x)((A_1n(i)*sin(Bn(1,i)*x/sqrt(9.1e-5))+B_1n(i)*cos(Bn(1,i)*x/sqrt(9.1e-5))).^2);
% si_1n =@(x)(A_1n(i)*sin(Bn(1,i)*x/sqrt(9.1e-5))+B_1n(i)*cos(Bn(1,i)*x/sqrt(9.1e-5)));
si_1nx = @(x)((A_1n(i)*sin(Bn(1,i)*x/sqrt(9.1e-5))+B_1n(i)*cos(Bn(1,i)*x/sqrt(9.1e-5))));
si_1ny = @(y)((A_1n(i)*sin(Bn(1,i)*y/sqrt(9.1e-5))+B_1n(i)*cos(Bn(1,i)*y/sqrt(9.1e-5))));
si_2ns = @(x)((A_2n(i)*sin(Bn(1,i)*x/sqrt(1.65e-5))+B_2n(i)*cos(Bn(1,i)*x/sqrt(1.65e-5))).^2);
si_2nx = @(x)((A_2n(i)*sin(Bn(1,i)*x/sqrt(1.65e-5))+B_2n(i)*cos(Bn(1,i)*x/sqrt(1.65e-5))));
% si_2n = @(x)(A_2n(i)*sin(Bn(1,i)*x/sqrt(1.65e-5))+B_2n(i)*cos(Bn(1,i)*x/sqrt(1.65e-5)));
si_2ny = @(y)((A_2n(i)*sin(Bn(1,i)*y/sqrt(1.65e-5))+B_2n(i)*cos(Bn(1,i)*y/sqrt(1.65e-5))));
Norm(i) = (226/9.1e-5)*integral(si_1ns,0,0.01)+(57.7/1.65e-5)*integral(si_2ns,0.01,0.02);
G_11 = @(y,tau)G_11 + @(y,tau)exp(-(Bn(i).^2)*(t-tau))*(226/9.1e-5)*(1/Norm(i))*si_1nx*si_1ny;
G_110 = @(x)(G_110 + (exp(-(Bn(i).^2)*(t))*(226/9.1e-5)*(1/Norm(i))*si_1nx*si_1ny));
% G_12 = @(y,tau)G_12 + exp(-(Bn(i).^2)*(t-tau))*(57.7/1.65e-5)*(1/Norm(i))*si_1nx*si_2ny;
% G_120 = @(x)G_12 + exp(-(Bn(i).^2)*(t))*(57.7/1.65e-5)*(1/Norm(i))*si_1nx*si_2ny;
% G_21 = @(y,tau)G_11 + exp(-(Bn(i).^2)*(t-tau))*(226/9.1e-5)*(1/Norm(i))*si_2nx*si_1ny;
% G_210 = @(x)G_11 + exp(-(Bn(i).^2)*(t))*(226/9.1e-5)*(1/Norm(i))*si_2nx*si_1ny;
% G_22 = @(y,tau)G_12 + exp(-(Bn(i).^2)*(t-tau))*(57.7/1.65e-5)*(1/Norm(i))*si_2nx*si_2ny;
% G_220 = @(x)G_12 + exp(-(Bn(i).^2)*(t))*(57.7/1.65e-5)*(1/Norm(i))*si_2nx*si_2ny;
end
theta_1=(To-T_inf)*integral(G_110,0,0.01); %+(To-T_inf)*integral(G_120,0.01,0.02)+(1.65e-5/57.7)*integral2(G_12,0.01,0.02,0,200);
0 Comments
Answers (1)
Ameer Hamza
on 8 Apr 2020
Although I believe that what you are trying to do, can be done in a much simpler way, it is easier to suggest a solution without seeing the mathematical equations. For your current code, you need to change the following two lines to make it work.
change
G_110=0;
to
G_110=@(x) 0;
and change
G_110 = @(x)(G_110 + (exp(-(Bn(i).^2)*(t))*(226/9.1e-5)*(1/Norm(i))*si_1nx*si_1ny));
to
G_110 = @(x)(G_110(x) + (exp(-(Bn(i).^2)*(t))*(226/9.1e-5)*(1/Norm(i))*si_1nx(x).*si_1ny(x)));
Similar changes need to be made to G_11 if you want to integrate it.
0 Comments
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!