フィルターのクリア

I do the optimization code but the graph of optimiazation didnt show up , I want to know what is wrong in my code ?

1 回表示 (過去 30 日間)
clear;clc;
global Kx Ky Kz m Cx Cy Cz Kxt Kyt Kzt mt Cxt Cyt Czt xg L1x L2x L1y L2y L1z L2z j Beta
wx=2*pi/1.11;
wy=wx;
wz=wx*100;
m=100;
mt=5/100;
Kx=m*wx^2;
Ky=m*wy^2;
Kz=m*wz^2;
Cx=2*0.05*m*wx;
Cy=2*0.05*m*wy;
Cz=2*0.05*m*wz;
sigmax=0.01;
sigmay=0.001;
wxt=4.1/2;
wxt=wx;
wyt=wxt;
wzt=2.9*wxt+sigmay;
%wzt=32^0.5*wxt;
%wxt=3;
%wyt=wxt;
%wyt=4.5;
%mt=0.6;
whar=wxt;
%whar=wyt;
Kxt=mt*wxt^2;
%Kxt=21.6;
%Kyt=21.6/4*2.25;
Kyt=mt*wyt^2;
Kzt=mt*wzt^2;
L1x=0.17;
L2x=0.375-L1x;
L1y=0.17;
L2y=0.375-L1x;
L1z=0.215;
L2z=mt*9.81/Kzt;
%L2z=0.001;
L2=0.01;
L1=1.0;
%wxt=6;
%Lx=1.;
%Lz=1. -mt*9.81/Kyt;
Beta=0.0;
%mt is for TMD
Kisay=0.05;
%Kisay=0.020;
%mt is for TMD
Cxt=2*0.023*(Kxt/mt)^0.5*mt; Cyt=2*0.023*(Kyt/mt)^0.5*mt;Czt=2*0.018*(Kzt/mt)^0.5*mt;
w=1.39;
%--------------------------------------------------------------------------
A=2.1*0.2;
dt=.02;tf=30.;t=0:dt:tf;n=tf/dt;%tsp=time step; tf=final time;
%load('CHICHI0968.mat');%CHICHI0968.mat-max of elcentro=0.3487
%ug=9.81*CHICHI0968(2,1:n+1);%%ELCENTRO_NS0348;A*(wx*w)^2*sin(wx*w*t);
ug=A*sin(wxt*w*t);
xg=ug;
%--------------------------------------------------------------------------
x0N=[0.014 0 0 0 0 0 0 0 0 0 0 0];x0L=x0N;xjN(1,:)=x0N;xjL(1,:)=x0L;
for j=1:n
%for j=1:3500
tint=dt*[j-1 j];%tint=time interval
[tN,xN] = ode45(@nonlinearmodel_structure,tint,x0N);
xjN(j+1,:)=xN(length(tN),:);
x0N=xN(length(tN),:);
%[tL,xL] = ode45(@linearmodel,tint,x0L);
%xjL(j+1,:)=xL(length(tL),:);
%x0L=xL(length(tL),:);
%j
end
%--------------------------------------------------------------------------
ux1=[xjN(:,1)];ux2=[xjN(:,2)];ux3=[xjN(:,3)];
save('Nolin.txt','xjN','-ASCII');
%ux1=[xjL(:,1)];ux2=[xjL(:,2)];
%uy1=[xjN(:,3) xjL(:,3)];uy2=[xjN(:,4) xjL(:,4)];
subplot(3, 1, 1)
plot(t, xg(1, :), 'k--', 'LineWidth', 1.5); hold on;
axis([0, 3, -1.2*max(max(xg(1, :))), 1.2*max(max(xg(1, :)))])
xlabel('Time (s)');
ylabel('Displacement (m)');
title("X direction plots non-linear model")
legend('Ground motion', 'Nonlinear model');
Warning: Ignoring extra legend entries.
grid on;
hold off
subplot(3, 1, 2)
plot(t, xg(1, :), 'k--', 'LineWidth', 1.5); hold on;
axis([0, 3, -1.2*max(max(xg(1, :))), 1.2*max(max(xg(1, :)))])
xlabel('Time (s)');
ylabel('Displacement (m)');
title("X direction plots linear model")
%--------------------------------------------------------------------------
% Define optimization problem
fun = @(A) cost_function(A, wx, w, t, xg(1, :), xjN, xjL, Beta);
x0 = 0.03;
lb = 0.01;
ub = 0.1;
options = optimoptions(@fmincon,'Algorithm','sqp','MaxIterations',1500);;
% Display results
fprintf('Optimal value of A: %f\n', Aoptxy);
Unrecognized function or variable 'Aoptxy'.
fprintf('Minimum cost: %f\n', costxy);
Z optimization
% Define optimization problem
fun = @(A) cost_function(A, wz, 2*w, t, xg(3, :), xjN, xjL, Beta);
x0 = 0.03;
lb = 0.01;
ub = 0.1;
options = optimoptions(@fmincon,'Algorithm','sqp','MaxIterations',1500);
% Solve optimization problem
[Aoptz, costz] = ga(fun, 1, [], [], [], [], lb, ub, [], options);
% Display results
fprintf('Optimal value of A: %f\n', Aoptz);
fprintf('Minimum cost: %f\n', costz);
X direction
% Plot results
figure;
grid on;
subplot(3, 1, 1)
plot(t, xg(1, :), 'k--', 'LineWidth', 1.5); hold on;
plot(t, xjN(1:1201,1), 'b-', 'LineWidth', 1.5); hold on;
axis([0, 3, -1.2*max(max(xg(1, :))), 1.2*max(max(xg(1, :)))])
xlabel('Time (s)');
ylabel('Displacement (m)');
title("X direction plots non-linear model")
legend('Ground motion', 'Nonlinear model');
grid on;
hold off
subplot(3, 1, 2)
plot(t, xg(1, :), 'k--', 'LineWidth', 1.5); hold on;
plot(t, xjL(1:1201,1), 'r-', 'LineWidth', 1.5);
axis([0, 3, -1.2*max(max(xg(1, :))), 1.2*max(max(xg(1, :)))])
xlabel('Time (s)');
ylabel('Displacement (m)');
title("X direction plots linear model")
legend('Ground motion', 'linear model');
grid on;
hold off
subplot(3, 1, 3)
plot(t, xg(1, :), 'k--', 'LineWidth', 1.5); hold on;
plot(t,0.5*Aoptxy*(wx)^2*sin(wx*w*t), 'g-', 'LineWidth', 1.5);
axis([0, 3, -2*max(max(xg(1, :))), 2*max(max(xg(1, :)))])
xlabel('Time (s)');
ylabel('Displacement (m)');
title("X direction plots Optimized model")
legend('Ground motion', 'Optimized model');
grid on;
hold off
Y direction
% Plot results
figure;
grid on;
subplot(3, 1, 1)
plot(t, xg(2, :), 'k--', 'LineWidth', 1.5); hold on;
plot(t, xjN(1:1201,2), 'b-', 'LineWidth', 1.5); hold on;
axis([0, 3, -1.2*max(max(xg(1, :))), 1.2*max(max(xg(1, :)))])
xlabel('Time (s)');
ylabel('Displacement (m)');
title("Y direction plots non-linear model")
legend('Ground motion', 'Nonlinear model');
grid on;
hold off
subplot(3, 1, 2)
plot(t, xg(2, :), 'k--', 'LineWidth', 1.5); hold on;
plot(t, xjL(1:1201,2), 'r-', 'LineWidth', 1.5);
axis([0, 3, -1.2*max(max(xg(1, :))), 1.2*max(max(xg(1, :)))])
xlabel('Time (s)');
ylabel('Displacement (m)');
title("Y direction plots linear model")
legend('Ground motion', 'linear model');
grid on;
hold off
subplot(3, 1, 3)
plot(t, xg(2, :), 'k--', 'LineWidth', 1.5); hold on;
plot(t,0.5*Aoptxy*(wx)^2*sin(wx*w*t), 'g-', 'LineWidth', 1.5);
axis([0, 3, -2*max(max(xg(1, :))), 2*max(max(xg(1, :)))])
xlabel('Time (s)');
ylabel('Displacement (m)');
title("Y direction plots Optimized model")
legend('Ground motion', 'Optimized model');
grid on;
hold off
Z direction
% Plot results
figure;
grid on;
subplot(3, 1, 1)
plot(t, xg(3, :), 'k--', 'LineWidth', 1.5); hold on;
plot(t, xjN(1:1201,3), 'b-', 'LineWidth', 1.5); hold on;
axis([0, 3, -1.2*max(max(xg(3, :))), 1.2*max(max(xg(3, :)))])
xlabel('Time (s)');
ylabel('Displacement (m)');
title("Z direction plots non-linear model")
legend('Ground motion', 'Nonlinear model');
grid on;
hold off
subplot(3, 1, 2)
plot(t, xg(3, :), 'k--', 'LineWidth', 1.5); hold on;
plot(t, xjL(1:1201,3), 'r-', 'LineWidth', 1.5);
axis([0, 3, -1.2*max(max(xg(3, :))), 1.2*max(max(xg(3, :)))])
xlabel('Time (s)');
ylabel('Displacement (m)');
title("Z direction plots linear model")
legend('Ground motion', 'linear model');
grid on;
hold off
subplot(3, 1, 3)
plot(t, xg(3, :), 'k--', 'LineWidth', 1.5); hold on;
plot(t,0.5*Aoptz*(wx)^2*sin(wx*2*w*t), 'g-', 'LineWidth', 1.5);
axis([0, 3, -2*max(max(xg(3, :))), 2*max(max(xg(3, :)))])
xlabel('Time (s)');
ylabel('Displacement (m)');
title("Z direction plots Optimized model")
legend('Ground motion', 'Optimized model');
grid on;
hold off
% Define function for cost function
cost_function
function [cost] = cost_function(A, wx, w, t, xg, xjN, xjL, Beta)
global m Kx Ky Kxt Kyt Cx Cy Cxt Cyt Lx Ly j
% Calculate optimized displacement
ug = A*(wx)^2*sin(wx*w*t);
xg = ug;
x0N = xjN(1,:);
x0L = xjL(1,:);
xjN_opt = zeros(size(xjN));
xjL_opt = zeros(size(xjL));
for j=1:length(t)
tint = t(j) + [0 1];
[~,xN] = ode15s(@nonlinearmodel, tint, x0N);
xjN_opt(j,:) = xN(end,:);
xN = zscore(xN);
x0N = xN(end,:);
[~,xL] = ode15s(@linearmodel, tint, x0L);
xL = zscore(xL);
xjL_opt(j,:) = xL(end,:);
x0L = xL(end,:);
end
% Calculate cost
cost = norm(xg - xjN_opt(1:1201,1)') + norm(xg - xjL_opt(1:1201,1)');
end
function dx=nonlinearmodel_structure(t,x)
global Kx Ky Kz m Cx Cy Cz Kxt Kyt Kzt mt Cxt Cyt Czt xg L1x L2x L1y L2y L1z L2z j Beta
dx = zeros(12,1);
dx(1)=x(7);
dx(2)=x(8);
dx(3)=x(9);
dx(4)=x(10);
dx(5)=x(11);
dx(6)=x(12);
%dx(1)=x(4);
%dx(2)=x(5);
%dx(3)=x(6);
%Vatar_x=((Lx+xx)^2+yy^2)^0.5;
% Vatar_y=((yy+mt*9.81/Kyt+Ly)^2+xx^2)^0.5;
dx(7)=1/m*(-Cx*x(7)-Kx*x(1)+...
-(-Cxt*(x(10)-x(7))...
-Kxt/2*( (x(4)-x(1))+L2x+(x(6)-x(3))^2*0.5*L1x/(L1x+L2x)^2+(x(5)-x(2))^2*0.5*L1x/(L1x+L2x)^2-(x(4)-x(1))*(x(6)-x(3))^2*L1x/(L1x+L2x)^3-(x(4)-x(1))*(x(5)-x(2))^2*L1x/(L1x+L2x)^3)...
+Kxt/2*(-(x(4)-x(1))+L2x+(x(6)-x(3))^2*0.5*L1x/(L1x+L2x)^2+(x(5)-x(2))^2*0.5*L1x/(L1x+L2x)^2+(x(4)-x(1))*(x(6)-x(3))^2*L1x/(L1x+L2x)^3+(x(4)-x(1))*(x(5)-x(2))^2*L1x/(L1x+L2x)^3)...
-Kyt/2*((x(4)-x(1))* (x(5)-x(2)) *L1y/(L1y+L2y)^2+(x(4)-x(1))*L2y/(L1y+L2y)+0.5*(x(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3))*(x(5)-x(2))^2*L1x/(L1x+L2x)^3-(x(6)-x(3)) *(x(4)-x(1))^2*L1x/(L1x+L2x)^3+0.5*(x(6)-x(3))^3*L1x/(L1x+L2x)^3)...
-Kxt/2*((x(6)-x(3))*(-(x(4)-x(1)))*L1x/(L1x+L2x)^2+(x(6)-x(3))*L2x/(L1x+L2x)+0.5*(x(6)-x(3))*(x(5)-x(2))^2*L1x/(L1x+L2x)^3-(x(6)-x(3))*(-(x(4)-x(1)))^2*L1x/(L1x+L2x)^3+0.5*(x(6)-x(3))^3*L1x/(L1x+L2x)^3))...
-xg(j)*sin(Beta)*0.+mt/mt*9.81;
end
  1 件のコメント
Torsten
Torsten 2023 年 5 月 23 日
Your code errors (see above). Better you run it first before posting to delete avoidable syntax errors.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeInertias and Loads についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by