Answered
why are some integrals not solvable in matlab?
Is it a numeric or symbolic integration? Most functions do not have a closed form integral. This is a mathematical limitation. ...

7 días ago | 0

Answered
Diagonals in Matrices Matlab
I'm not sure if I can follow your explanations. A short example might be useful. The term "be -.25 for every 2 instances" might...

8 días ago | 1

| accepted

Answered
I have 2011a on my machine. I installed 2014a. it is always running MATLAB2014a, how to select MATLAB2011 for running please?
How do you start Matlab? The exact method to start a specific Matlab version depend on the operating system. But the way is to i...

8 días ago | 0

Answered
Trying to use a for loop to calculate years with an IF statement but it seems to ignore it.
Either for M = 2:300 if balance(M) >= 50000 %balance(M) break; % Leave the for M loop end % NOPE ! M =...

8 días ago | 0

Answered
How to plot a smooth curve with only a few points?
Either decide for a linear interpolation: x = 1:6; y = rand(1, 6); plot(x, y, 'ko'); hold on xx = linspace(1, 6, 100); ...

8 días ago | 0

| accepted

Answered
Is rsqrt the same as Fast inverse square root?
i = * ( long * ) &y This is equivalent to: y = single(pi); i = typecast(y, 'int32'); The shown code of Q_rsqrt is an ap...

8 días ago | 0

Answered
I am getting Undefined function or variable 'A', error in Untitled line 95
The variable A should be polulated in this line: A(rr,:,z) = [sod,rangeL1,rangeL2]; If A in undefined, this line was not c...

8 días ago | 0

| accepted

Answered
ODE45 is taking hours and hours to compute
Symbolic omputations need a lot of time. Can you implement the code numerically? If the equation to be integrated is stiff, ODE...

8 días ago | 0

Answered
semilogy, loglog do not work in order to set the y axis on a logarithmic scale
After figure, hold on the YScale is determined already. Define it explicitly instead and you plot(): figure axes('yscale', 'lo...

9 días ago | 0

| accepted

Answered
About 3 significant digit?
fprintf('%.3g\n', pi) fprintf('%.3g\n', pi * 1e6) fprintf('%.3g\n', pi * 1e-6)

10 días ago | 0

Answered
"Too many output arguments" error while working with the fmincon solver inside the optimization tool.
A bold guess: [solution,objectiveValue] = fmincon(@objectiveFcn,w,[],[],[],[],[],[],... @objectiveFcn,options2); % ^^^^...

10 días ago | 0

| accepted

Answered
Arithmetic coding and Huffman
https://www.mathworks.com/help/comm/ref/arithenco.html https://www.mathworks.com/help/comm/ref/huffmanenco.html Man further c...

10 días ago | 0

Answered
Calculation of the average of 80X80 blocks of 800X1280 Excel sheet data
Import the data. Then you have a [800 x 1280] matrix. It does not matter, if the data have been stored in an Excel file. Then: ...

10 días ago | 0

| accepted

Answered
Build array from for loop
n = 100; c = cell(1, n); for k = 1:n c{k} = rand(1, randi(10)); end result = cat(2, c{:}); This avoids an iteratively g...

10 días ago | 0

| accepted

Answered
Nested struct arrays with variable format
You can't. S = struct('Name1', cell(n1, 1), ... 'Name2', cell(n1, 1)) his creates a [n1 x 1] struct array with two...

10 días ago | 0

| accepted

Answered
finding divisibility in every number from 1 to 25
If x can by divided by y: rem(x, y) == 0 Or: x / y == round(x / y) Another apporach is to calculate the list of multiples of...

11 días ago | 0

Answered
Central difference method or Diff for trajectories?
There are different methods for numerical differentiation. Assume you have the positions store in x and the times in t. Then: F...

11 días ago | 1

| accepted

Answered
Find equal pentagonal and square number
And a two-liner: n = 1:10000; find(any(((3*n.^2 - n)/2) == (n.^2).')) Matlab can be very elegant. Do you understand the detai...

11 días ago | 0

Answered
Find equal pentagonal and square number
This sounds like a homework question. Then the standard way is that you post, what you have tried so fas and ask a specific ques...

12 días ago | 0

| accepted

Answered
for loop stack the data
Maybe: col = cell(1, 176); row = cell(1, 176); for k = 77:176 [col{k}, row{k}] = find(M == k); end

12 días ago | 0

Answered
how can i solve the error Reference to non-existent folder
I guess, that the code is not: ficheiro = fullfile(files(5), files(5).name); % but: ficheiro = fullfile(files(5).folder, file...

12 días ago | 0

Answered
calculating combinations of two vectors simultanously?
a = [1, 3, 5, 7, 9]; b = [2, 4, 6, 8, 10]; index = nchoosek(1:numel(a), 3); a(index) b(index)

12 días ago | 0

Answered
Converting 1 and 2 to False and True
result = [1; 2; 1; 1; 2]; Pool = {'FALSE', 'TRUE'}; Pool((result == 1) + 1)

12 días ago | 0

Answered
Creating a counter inside the ode45 function
This is not useful. ODE45 has a stepsize controller, which rejectes steps if they do not match the tolerances. This means, that ...

12 días ago | 0

Answered
Failed to convert character code error
See: https://www.mathworks.com/matlabcentral/answers/561905-error-with-new-version-of-readtable-r2020a This is a limitation of ...

12 días ago | 0

Answered
The most efficient way to do multiple summation in Matlab?
After the code runs in half a minute now instead of a couple of days, it is time to examine the numerical stability: for i3 = 0...

12 días ago | 0

| accepted

Answered
The most efficient way to do multiple summation in Matlab?
% Timings on: Matlab R2018b, Win10, i7: tic % A small k for bearable run times at first: YourSum_ori...

13 días ago | 0

Answered
Is there a better way to use cellfun with arguments? and is it better than for-loop?
sizes = cellfun('size', cellArr, 1); Using the CHAR vector arguments is mentioned in the documentation as "backward compatibili...

13 días ago | 1

| accepted

Answered
Strange result of find function
% Time_indices = find(abs([files(index).data.time]-t')< eps); % ^ If t and [...

13 días ago | 0

| accepted

Answered
Replacing for loop in the function
Does f() accept a row vector as input? Does it reply a row vector or matrix then? If so: function I = func(f, a, b, n) h = (b ...

13 días ago | 1

Load more