Answered

Writing an Optimization Problem

I am not sure why yours doesnt work, but it works if the functions are written in array form like this: clear fun = @(x) (x(1)...

Writing an Optimization Problem

I am not sure why yours doesnt work, but it works if the functions are written in array form like this: clear fun = @(x) (x(1)...

2 dagar ago | 1

Answered

exitFlag meaning in GA solver

As I know, good solution is when it converges, the change of few last iteration does not improves (exit flag 1, 3). Or when so...

exitFlag meaning in GA solver

As I know, good solution is when it converges, the change of few last iteration does not improves (exit flag 1, 3). Or when so...

12 dagar ago | 1

| accepted

Answered

Find indexs of minimum in 4-D matrix.

Maybe linear means the index ordered in from high dimension to one dimension. For example, for 2D matrix with 2 rows and 3 colum...

Find indexs of minimum in 4-D matrix.

Maybe linear means the index ordered in from high dimension to one dimension. For example, for 2D matrix with 2 rows and 3 colum...

15 dagar ago | 0

Answered

gaplotpareto not supported for this algorithm

Have you tried this advice? https://www.mathworks.com/matlabcentral/answers/63086-gaplotpareto-for-3-objective-functions

gaplotpareto not supported for this algorithm

Have you tried this advice? https://www.mathworks.com/matlabcentral/answers/63086-gaplotpareto-for-3-objective-functions

18 dagar ago | 0

| accepted

Question

Add new line in middle of line of a text file

I have a bug in my text file. There should be new line at this blue line: I have tried to code to fix this: subdir = 'TCLFil...

ungefär en månad ago | 0 answers | 0

Answered

How to fix timestep in this code?

You can check your equation part by part to check whether your code or calculation is correct. For example, for n=2: Ve*dm = 22...

How to fix timestep in this code?

You can check your equation part by part to check whether your code or calculation is correct. For example, for n=2: Ve*dm = 22...

ungefär en månad ago | 0

Answered

How do I solve an eigenvector for the amplitude matrix 'A' mode

Are you trying to make eigendecomposition of mass & stiffness matrix? Try this: [U,Omega2] = eig(inv(M)*K); % Eigen decomp...

How do I solve an eigenvector for the amplitude matrix 'A' mode

Are you trying to make eigendecomposition of mass & stiffness matrix? Try this: [U,Omega2] = eig(inv(M)*K); % Eigen decomp...

ungefär en månad ago | 0

Answered

Finding Angle between 2 points

Is this what you mean? P1 = [10 210]; P2 = [140 210]; Z0 = [(P1(1)+P2(1))/2 225]; % Reference point, assuming it is in the m...

Finding Angle between 2 points

Is this what you mean? P1 = [10 210]; P2 = [140 210]; Z0 = [(P1(1)+P2(1))/2 225]; % Reference point, assuming it is in the m...

ungefär en månad ago | 0

Submitted

OpenSees-Matlab Interaction of Truss Example

This is example code on how to interact between OpenSees and Matlab

ungefär 2 månader ago | 4 downloads |

Answered

Saving / Showing Value of Variables in Genetic Algorithms

This guy here give an example output function to obtain variable in each iteration on a pattern search optimization. Maybe it is...

Saving / Showing Value of Variables in Genetic Algorithms

This guy here give an example output function to obtain variable in each iteration on a pattern search optimization. Maybe it is...

ungefär 2 månader ago | 0

Answered

why points examined in Pattern Search exceed the lower or Upper bounds and is there any way to avoid this?

What is your initial point and initial mesh size? Perhaps these already exceeds your bounds. Edit: Hmm, what if you normalize ...

why points examined in Pattern Search exceed the lower or Upper bounds and is there any way to avoid this?

What is your initial point and initial mesh size? Perhaps these already exceeds your bounds. Edit: Hmm, what if you normalize ...

ungefär 2 månader ago | 0

| accepted

Answered

How to skip paretosearch iteration

In the objective function, you can put a large penalty or result to make it like a bad result, so pattern search won't consider ...

How to skip paretosearch iteration

In the objective function, you can put a large penalty or result to make it like a bad result, so pattern search won't consider ...

3 månader ago | 0

Submitted

Linear Dynamic Analysis of MDOF system using ODE

Response computation of linear dynamic (time history) analysis of multi-degree of freedom system using ordinary differential equ...

3 månader ago | 20 downloads |

Question

fprintf can't make new line

I want to edit a line of a text file (tcl file actually). I tried with following code: A = 5; tcl = regexp(fileread('old_file....

3 månader ago | 1 answer | 0

Question

Rotate 3D surface matrices

I have three matrices for surf command: X, Y, Z. I need to rotate the matrices along z-axis by some degrees. I remember there is...

3 månader ago | 1 answer | 0

Answered

Finding Rest of Row

Do you mean like vlookup in excel? Try this: data = randi(1,4,5); % Just an example matrix first = data(randi(4),1); % Example...

Finding Rest of Row

Do you mean like vlookup in excel? Try this: data = randi(1,4,5); % Just an example matrix first = data(randi(4),1); % Example...

3 månader ago | 0

| accepted

Answered

Battery charging profile - Most efficient way of plotting

I have suggestion for your long repetitive elseif, try to use this instead: z = randi(100); zLim = [logspace(0,2,9) Inf]; % li...

Battery charging profile - Most efficient way of plotting

I have suggestion for your long repetitive elseif, try to use this instead: z = randi(100); zLim = [logspace(0,2,9) Inf]; % li...

3 månader ago | 1

Answered

How to plot graph from equation

I'm not sure what do you want, is it like this? x3 = [1 0.1 0.01 0.001]; x2 = zeros(3,4); for i=1:4 x1 = [-2 1 0;1 -2 1;...

How to plot graph from equation

I'm not sure what do you want, is it like this? x3 = [1 0.1 0.01 0.001]; x2 = zeros(3,4); for i=1:4 x1 = [-2 1 0;1 -2 1;...

3 månader ago | 0

| accepted

Answered

Error using optimization tool bx

Try this [x,fval] = ga(@objective,6); function f = objective(x) f = -2.84.*x(:,1)+0.22.*x(:,2)+3.33.*x(:,3)-1.09.*x(:,4...

Error using optimization tool bx

Try this [x,fval] = ga(@objective,6); function f = objective(x) f = -2.84.*x(:,1)+0.22.*x(:,2)+3.33.*x(:,3)-1.09.*x(:,4...

3 månader ago | 0

Answered

Add legend to each figure()???

You need to make the x and y data separately, like this: figure(1) plot(x,P1) hold on plot(x,P2) plot(x,P3) plot(x,TotalDe...

Add legend to each figure()???

You need to make the x and y data separately, like this: figure(1) plot(x,P1) hold on plot(x,P2) plot(x,P3) plot(x,TotalDe...

3 månader ago | 0

Answered

Summing up the answers in for loop that meets criteria

Try this criteria=zeros(220,1) for n = 1:220 pfc = A(combi(n,1),1:270); fef = B(combi(n,2),1:270); zpfc = zscore(pfc); zf...

Summing up the answers in for loop that meets criteria

Try this criteria=zeros(220,1) for n = 1:220 pfc = A(combi(n,1),1:270); fef = B(combi(n,2),1:270); zpfc = zscore(pfc); zf...

3 månader ago | 0

| accepted

Answered

Nonlinear constraint function with the optimization toolbox

Seems you have extra parameters beside the optimization input variables. See these explanation: https://www.mathworks.com/help...

Nonlinear constraint function with the optimization toolbox

Seems you have extra parameters beside the optimization input variables. See these explanation: https://www.mathworks.com/help...

4 månader ago | 0

| accepted

Submitted

Plot Frame Structure

Function for plotting frame/bar structure from node coordinate and element connectivity matrix

4 månader ago | 6 downloads |

Question

How to call variable (with index) using string?

Suppose I have many variables with arbitrary names in my workspace with all same size. I also have an identical logical index fo...

4 månader ago | 3 answers | 0

Question

How to delete axes and tick in figure?

I make a contour plot, and then add another line plot in the same figure. For example: contour(x,y,z) hold on plot(xx,yy) ho...

5 månader ago | 1 answer | 0

Answered

The variable Edj appears to change size consider preallocating

The size of your matrix changes at every iteration. Make zero matrix before looping. For example: Edj = zeros(d,n); *edited fo...

The variable Edj appears to change size consider preallocating

The size of your matrix changes at every iteration. Make zero matrix before looping. For example: Edj = zeros(d,n); *edited fo...

5 månader ago | 0

| accepted

Solved

Vector creation

Create a vector using square brackets going from 1 to the given value x in steps on 1. Hint: use increment.

5 månader ago

Solved

Doubling elements in a vector

Given the vector A, return B in which all numbers in A are doubling. So for: A = [ 1 5 8 ] then B = [ 1 1 5 ...

5 månader ago

Solved

Flip the vector from right to left

Flip the vector from right to left. Examples x=[1:5], then y=[5 4 3 2 1] x=[1 4 6], then y=[6 4 1]; Request not ...

5 månader ago