Effacer les filtres
Effacer les filtres

error in matrix multiplication and integration

3 vues (au cours des 30 derniers jours)
Milan
Milan le 27 Oct 2022
Commenté : Walter Roberson le 28 Oct 2022
%%
clc;
clear;
syms x;
%pi = 180.;
% syms y_x;
% syms y_x_das;
L = 100.;
E = 29000. ;
c = 0.1*L;
d_0 = 5.;
d_1 = 2.*d_0;
d_x = 2.*d_0*(x/(2.*L));
b = 2.;
I_z = (b*d_x.^3)/12.;
G = 11000.;
A_x = b*d_x;
As = 5/6*A_x;
y_x = c*sin(2*pi*x/L);
y_x_das = diff(y_x);
theta_2 = atan(y_x_das);
Q_a = [-cos(theta_2) -sin(theta_2) 0];
Q_s = [-sin(theta_2) -cos(theta_2) 0];
Q_b = [-c*sin((2*pi*x)/L) x -1];
%%
%flexibility matrix
d1= sqrt(1 + y_x_das.^2).*((Q_a'.*Q_a)./(A_x*E));
d1_int = integral(@(x) d1(), 0, 100., 'ArrayValued', 1);
Error using superiorfloat
Inputs must be floats, namely single or double.

Error in integralCalc/iterateArrayValued (line 159)
outcls = superiorfloat(x,fxj);

Error in integralCalc/vadapt (line 130)
[q,errbnd] = iterateArrayValued(u,tinterval,pathlen);

Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);

Error in integral (line 87)
Q = integralCalc(fun,a,b,opstruct);
  9 commentaires
Milan
Milan le 28 Oct 2022
Modifié(e) : Torsten le 28 Oct 2022
%unit inch, ksi,
clc;
clear;
close;
Pi = sym(pi);
syms x real
L = 100.;
E = 29000. ;
c = 0.1*L;
d_0 = 5.;
b = 2.;
d_1 = b*d_0;
d_x = @(x) 2.*d_0*(1-(x/(2.*L)));
b = 2.;
I_z = @(x) (b*d_x(x).^3)/12.;
G = 11000.;
A_x = @(x) b*d_x(x);
As = @(x) 5/6*A_x(x);
y_x = @(x) c*sin(2*Pi*x/L);
y_x_das = @(x) gradient(y_x(x))./gradient(x);
theta_2 = @(x) atan(y_x_das(x));
Q_a = @(x) [-cos(theta_2(x)) -sin(theta_2(x)) 0];
Q_s = @(x) [sin(theta_2(x)) -cos(theta_2(x)) 0];
Q_b = @(x) [-c*sin((2*Pi*x)/L) x -1];
%%
%flexibility matrix
d1 = @(x) sqrt(1 + y_x_das(x).^2).*((Q_a(x)'.*Q_a(x))./(A_x(x)*E));
d1_x = d1(x);
d1_int = int(d1_x, 1e-8, L);
d_11 = vpa(d1_int);
d2 = @(x) sqrt(1 + y_x_das(x).^2).*(Q_s(x)'.*Q_s(x))./(G*As(x));
d2_x = d2(x);
d2_int = int(d2_x, 1e-8, L);
d_22 = vpa(d2_int);
%no shear consideration
% G_noshear = Inf;
% d2_noshear = @(x) sqrt(1 + y_x_das(x).^2).*(Q_s(x)'.*Q_s(x))./(G_noshear*As(x));
% d2_x_noshear = d2_noshear(x);
% d2_int_noshear = int(d2_x, 1e-8, L);
% d_22_noshear = vpa(d2_int);
d_22_noshear = 0;
d3 = @(x) sqrt(1 + y_x_das(x).^2).*(Q_b(x)'.*Q_b(x)) ./(E*I_z(x));
d3_x = d3(x);
d3_int = int(d3_x, 1e-8, L);
d_33 = vpa(d3_int);
d = d_11+d_22+d_33; %flexibility matrix
d_noshear = d_11+d_33;
% equllibrium matrix
phi = [-1 0 0; 0 -1 0; 0 L -1];
%Siffness matrix
Kff = inv(d);
Kfs = inv(d)*phi';
Ksf = phi*inv(d);
Kss = phi*inv(d)*phi';
K = round([Kff Kfs; Ksf Kss], 2);
%no shear stiffness matrix
Kff_ns = inv(d_noshear);
Kfs_ns = inv(d_noshear)*phi';
Ksf_ns = phi*inv(d_noshear);
Kss_ns = phi*inv(d_noshear)*phi';
K_noshear = round([Kff_ns Kfs_ns; Ksf_ns Kss_ns], 2)
K_noshear = 
% K = [inv(d) inv(d).*phi';
% phi.*inv(d) phi.*inv(d).*phi'];
sdof = ([1, 2, 5]);
fdof = ([3,4,6]);
K_ff = K(fdof, fdof);
f_f = [300 100 0]';
delta_f = inv(K_ff)*f_f;
theta_z1 = round(delta_f(1,:),5);
Walter Roberson
Walter Roberson le 28 Oct 2022
mat2str() will show it with just one []
Note: mat2str() may lose the bottom bit of numbers. format long g loses the bottom bit of numbers. If you need to be able to exactly reproduce the array then you will need to create your own function to convert it.

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by