답변 있음
GA optimisation how to find maxima instad of minima.
(The only way I found is to put a minus in the y(1) equation.) This is the perfect solution already.

4년 초과 전 | 0

| 수락됨

답변 있음
How to make uicontrol edit box only show the text when needed?
You can simply delete the 'String' property of the text box, when the checkbox is disabled and store the contents e.g. in the Us...

4년 초과 전 | 0

답변 있음
solving second order differential equation using ode45
Convert the 2nd order equation into a set of 1st order equations: dy(1) = y(2); dy(2) = (1 - y(1)^2) * y(2) - y(1); See: http...

4년 초과 전 | 0

답변 있음
Problem with RC5 Image encryption
For images, "plain text" means the sequence of bytes. Import the image file by fopen&fread(fid, Inf, '*uint8'), not by imread()....

4년 초과 전 | 0

답변 있음
Is is possible to leave the dialog box created with inputs open after clicking ok?
Yes. Simply create a dialog box which have an "Apply" button. That "Ok" closes the dialog is the standard look&feel, so changing...

4년 초과 전 | 0

| 수락됨

답변 있음
Turning a sequence of operations into a function
Start with simplifying the code: k is i+1 in all cases, so omit k and use i+1. Pre-allocate f1 by zeros() to avoid n iterative...

4년 초과 전 | 0

답변 있음
Getting the 3 lowest values in a vector Matlab
a = [12,3,9, 5.6, 9, 10, 7]; b = mink(a, 3)

4년 초과 전 | 0

답변 있음
How can i perform for loop in this case?
x = rand(51, 1); M = repmat(x, 1, 71, 3); size(M)

4년 초과 전 | 0

답변 있음
While loop to find index of first element to be less than and greater than in a vector
It is impossible, that a number is smaller than 0.42 and greater than 0.52: a(n) < 0.42 && a(n) > 0.52 % ^ ^ ...

4년 초과 전 | 0

답변 있음
Trying to fix the loop
nFail = 0; for n = 1:5 Vehicle_Type = input('Enter the Vehicle Type', 's'); switch lower(Vehicle_Type) case 'co...

4년 초과 전 | 0

| 수락됨

답변 있음
Aligning numbers with text in a table
% 13 characters and aligned to the right: fprintf('%13s %13s %13s %13s \n', 'a', 'yes','async','asychronous'); % 13 characters...

4년 초과 전 | 1

| 수락됨

답변 있음
not enough input arguments( not what you think)
"its says x=x0 in line 6 but this specific data is not in line 6" This means, that you do not call the function you think you a...

4년 초과 전 | 0

답변 있음
What changes are needed to run the code
ODE = @(x,y) [ ... y(2); ... y(3); ... (A.*(y(2)+0.5*x*y(3)) - y(1)*y(3) + y(2)*( y(2)+M^2*(sin(Psi))^2) - L1*y(4...

4년 초과 전 | 0

답변 있음
image encryption using rc4 : error in bitxor
You instruct PRGA to reply 128 values: Cipher = uint8(PRGA(KSA(key), size(original,2))); I assume you want: Cipher = uint8(PR...

4년 초과 전 | 0

| 수락됨

답변 있음
Modify drawnow limitrate to update only 10 frames per second.
figure; axes('NextPlot', 'add'); tic; while 1 plot(rand, rand) if toc > 0.1 drawnow; tic; end end ...

4년 초과 전 | 0

| 수락됨

답변 있음
How to generate images of binary random speckle patterns
This topic is discussed frequently here: https://www.mathworks.com/matlabcentral/answers/?term=tag%3A%22circle+packing%22

4년 초과 전 | 0

답변 있음
I am getting error says parse error
I guess, that the line before is the problem: options = Remember to append a ... as line continuation. This is no valid Matla...

4년 초과 전 | 0

답변 있음
How can I change the order of an N-dimensional array?
X = permute(X, [3,1,2,4]);

4년 초과 전 | 0

| 수락됨

답변 있음
Line plot not showing up in for loop iteration
What exactly is trhe problem with your code? Maybe all you need is to insert a drawnow command after the plotting? By the way,...

4년 초과 전 | 0

답변 있음
Printing the entire array row in Matlab
a = [12,3,4,5]; b = [4,5,12,3]; fprintf('a: [%s]\n', join(string(a), ',')); fprintf('b: [%s]\n', join(string(b), ','));

4년 초과 전 | 8

답변 있음
how I create improved lorenz code
The test contains cos(dt), but your code only cos(t).

4년 초과 전 | 0

| 수락됨

답변 있음
Unrecognized function or variable 'setupgraph'
You have mentiones the source of the dijkstra function in your other thread: https://www.mathworks.com/matlabcentral/fileexchang...

4년 초과 전 | 0

| 수락됨

답변 있음
find if one number is member of a column ,of cell array, that contains cell entries and if it is member, in which row, it appears
Simplify the data representation at first: for k = 1:size(C, 1) C{k, 5} = [C{k, 5}{:}]; end Then the searching is easy: ...

4년 초과 전 | 0

| 수락됨

답변 있음
function handle specify in matlabfcn function
According to the documentation doc matlabfcn : =matlabfcn("quadgk(@(x) x.^2)", M3, M4)

4년 초과 전 | 0

답변 있음
Define matrix function to output matrix
A = rand(3); fumn(A, @sqrt) fumn(A, @(x) 1 ./ x) fumn(A, @(x) exp(-x)) function f = fumn(A, fcn) f = fcn(A); end

4년 초과 전 | 0

답변 있음
Reducing the running time of a for loop iterating through cells
Is C pre-allocated? Why do you use square brackets? This is the concatenation operator in Matlab. As far as I understand the us...

4년 초과 전 | 0

답변 있음
why in this function they use empty square brackets?
A(i,:) = []; This deletes the i.th row of the matrix A. Example: A = [1,2,3; 4,5,6; 7,8,9]; A(1, :) = [] % A = [4,5,6; 7,...

4년 초과 전 | 2

답변 있음
Open to feedback for my code
[] is Matlab's operator for a concatenation. [0.05] concatenates the numnbre 0.05 with nothing, therefore this is a waste of tim...

4년 초과 전 | 0

| 수락됨

답변 있음
Help with a loop that computes at each step
hs = [0.05, 0.05/2, 0.05/4, 0.05/8, 1/1000]; for k = 1:numel(hs) h = hs(k); N = totalDuration / h; % ??? y = y...

4년 초과 전 | 0

| 수락됨

답변 있음
How to call functions from inside an if statement only once?
I'm not sure if I understand you correctly, but maybe: for tt = 2: 50 ... if tt > 2 || M(tt) >= 0.3 * N [G_dmg, ~] =...

4년 초과 전 | 0

더 보기