Answered
Find maximum intermediate product in matrix multiplication
Another way using a loop, which avoids the potentially large intermediate result if the dimensions happen to be large. func...

8 years ago | 1

| accepted

Answered
ode numerical answer with euler-method
You do it for vectors pretty much the same way you would do it for scalars. The main difference would be that you need to accoun...

8 years ago | 1

Answered
Remove elements from cell array
E.g., result = cellfun(@(x,y)x(~ismember(x,cell2mat(y))),array1,toRemove,'uni',false);

8 years ago | 0

| accepted

Answered
Random number between 0 and the value of another variable
q = rand*(1-p);

8 years ago | 1

| accepted

Answered
Matrix product along one of the dimensions of 3D array
See this link for options: <https://www.mathworks.com/matlabcentral/answers/371421-how-to-multiply-n-matrices-without-a-for-l...

8 years ago | 1

Answered
Lotka-volterra with ode45
Problem may be stiff. Try ode15s instead.

8 years ago | 0

| accepted

Answered
Error using ode45
Incorrect number of arguments for the derivative function, and incorrect syntax within that function. E.g., function y=opd...

8 years ago | 0

| accepted

Answered
diag problem while substracting
It's just a display format thing. It means each number shown is actually multiplied by 1.0e-15 E.g., >> [1 2 3] ans ...

8 years ago | 1

| accepted

Answered
I want to create a binary matrix in matlab in which each element must be 4 bit. ??
Not sure what you really want. If you are looking for a character array of "bits" then you could use dec2bin. E.g., >> de...

8 years ago | 0

Answered
Add Column Data to Existing Data Array at Specific Locations MATLAB
Going on faith that this is not homework, e.g., assuming that your ind vector has the correct number of 0's and 1's to account f...

8 years ago | 1

| accepted

Answered
Disable automatic termination of mex functions
Not from within the mex function that I am aware of. When these errors occur in an API library routine, of course the routine d...

8 years ago | 0

| accepted

Answered
creating a matrix where the element of the second column is smaller than the element of the first column
E.g., n = largest number (e.g., 3) result = cell2mat(arrayfun(@(x)[ones(x,1)*x,(1:x)'],1:n,'uni',false)');

8 years ago | 0

Answered
always get 255 in sum
Variable P is likely class uint8. Assuming this is true, the summing is done as uint8 which clips at the highest value of 255 f...

8 years ago | 0

| accepted

Answered
How do I find independent equations from a system of linear equations?
See this link: <https://www.mathworks.com/matlabcentral/answers/108835-how-to-get-only-linearly-independent-rows-in-a-matrix-...

8 years ago | 0

Answered
How to create a function with multiple calculations
Create a file called triangle_area.m on your path (e.g. in your working directory) and inside that function have this code: ...

8 years ago | 0

Answered
How can i decode(unpack) an array of bits with a constant value?
Not sure what the "rule" really is for getting the bits. Maybe one of these? x = your vector L = your number result ...

8 years ago | 1

| accepted

Answered
Is it possible to use mat.h outside Matlab?
You can use it e.g. in an Engine application program as opposed to a mex routine. But even in the Engine application program yo...

8 years ago | 0

Answered
Normalizing columns: Does my function do the same as "normc"?
Yes, your algorithm matches normc (R2016b Win64): >> m m = -0.3223 0.4342 0.2442 0.0030 -0.3323 ...

8 years ago | 0

Answered
why calculation time become slow when I use mex file?
For linear algebra calculations, such as matrix*vector products, MATLAB actually calls a 3rd party highly optimized multi-thread...

8 years ago | 1

Answered
Is there a way to assign a value to multiple diagonals in a matrix?
E.g., for a square matrix: >> X = zeros(6,6) X = 0 0 0 0 0 0 0 0 0 0 ...

8 years ago | 2

| accepted

Answered
Solve equation of motion using ode45!
figure;plot(t,y(:,1));grid on figure;plot(t,y(:,2));grid on

8 years ago | 0

| accepted

Answered
Inserting multiple columns into an existing matrix in equal distance
E.g., yellowx = reshape(yellow,[],size(red,2)); result = reshape([red;yellowx],size(red,1),[]);

8 years ago | 0

| accepted

Answered
Remove columns for a cell array
Not sure what Z really is from your description. Maybe one of these will work for you: Z(:,2001:end) = []; % assumes Z is...

8 years ago | 1

Answered
How many times does the vector change sign?
As long as there are no 0's, you could use something like this: result = numel(find(diff(sign(signal)))); If there are 0...

8 years ago | 0

| accepted

Answered
How to create time series with C API?
You could use mexCallMATLAB for this. Did you want to build the object with some existing data?

8 years ago | 0

Answered
New to matlab, need help with problem..
Good start. Thank you for posting your code. Some help: - Have the top value of your loop be 300, not 299 - Have the Tot...

8 years ago | 0

Answered
Can one run a matlab script from the command line and pass arguments to it **without making it into a function**?
You could have your script use the getenv( ) function to retrieve all of those environment variables (as strings). Or have your...

8 years ago | 0

Answered
how can I create help product for my function in matlab?
Put all of your help text in comments at the top of the file. E.g., here is a file called mycube.m % MYCUBE Calculates the...

8 years ago | 0

Answered
Repeating a row vector in MATLAB until it reaches a specified length.
result = k(mod(0:numel(j)-1,numel(k))+1);

8 years ago | 0

Load more