You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
834 B
31 lines
834 B
%--------------------------
|
|
% @Author: Jingqiao Hu
|
|
% @Date: 2021-01-07 11:33:57
|
|
% @LastEditTime: 2021-01-08 17:02:15
|
|
%--------------------------
|
|
function n_opt = fast_optNH(A12, b12, Q_obj, num_ndofs, u_ma, u_mi)
|
|
|
|
[A, b] = constriant(A12, b12, num_ndofs, u_ma, u_mi);
|
|
|
|
n = quadratic_programming(A, b, Q_obj);
|
|
n_opt = reshape(n, [], num_ndofs);
|
|
% n_opt = reshape(n, num_ndofs, [])'; % [2v,2n]
|
|
end
|
|
|
|
function [A, b] = constriant(A12, b12, num_ndofs, u_ma, u_mi)
|
|
% cons3: micro deformation
|
|
I3 = eye(num_ndofs);
|
|
A3 = kron(I3, u_ma'); % [1,2v] -> [2n,2n*2v]
|
|
% A3 = kron(u_ma', I3); % [1,2v] -> [2n,2n*2v], NOTE: the sequence
|
|
|
|
b3 = u_mi;
|
|
|
|
% n1 = (1:8*num_ndofs)';
|
|
% ttt = A3 * n1 - b3;
|
|
% save ttt ttt
|
|
|
|
% compute
|
|
A0 = [A12; A3];
|
|
A = sparse(A0);
|
|
b = sparse([b12; b3]);
|
|
end
|