Answered
How to extract N array from a for loop?
The question is not really clear to me. With some guessing: a = cell(1, 2); % Pre-allocate for i = 1:2 x = input('ent...

4 years ago | 1

Answered
How to solve second order coupled ODEs with bvp4c?
function dy = YourODE(t, y) k = 17; dy = [y(3); ... y(4); k * y(1) * y(2); ... k * y(1) * y(2)]; end I...

4 years ago | 0

| accepted

Answered
i want to solve that system using 4 order kutta method
The output is a simple point at [0, 0]. You start at 0. Then the expression x2/(x2/20) + 1 is NaN, because you divide by 0: x2...

4 years ago | 2

| accepted

Answered
repmat usage for cellarray
If this is what you want: cell_array = PG01 PG02 PG03 . . . PG32 PG01 PG02 PG03 . . . PG32 . . ...

4 years ago | 0

| accepted

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

Answered
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 years ago | 0

Answered
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 years ago | 0

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

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

4 years ago | 0

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

4 years ago | 0

Answered
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 years ago | 0

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 1

| accepted

Answered
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 years ago | 0

Answered
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 years ago | 0

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

Answered
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 years ago | 0

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

4 years ago | 0

| accepted

Answered
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 years ago | 0

Answered
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 years ago | 8

Answered
how I create improved lorenz code
The test contains cos(dt), but your code only cos(t).

4 years ago | 0

| accepted

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

| accepted

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

4 years ago | 0

Answered
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 years ago | 0

Answered
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 years ago | 0

Load more