Respondida
Can anyone help to creat this vector ?
You're close, but you need to handle the W(i)=V(i) differently. The way you have it currently coded, this line is overwriting al...

más de 8 años hace | 0

| aceptada

Respondida
Polynomial fit from the equation
You appear to have both x and time meaning the same thing, and y and data meaning the same thing. Maybe it is just a variable na...

más de 8 años hace | 0

Respondida
how to return column index in matrix
x = your original matrix [~,idx] = min(x,[],2);

más de 8 años hace | 2

| aceptada

Respondida
what's the second variable in size function do ?
The second argument to the size function designates the particular dimension that you want. E.g., in your example, f is a 1x4. T...

más de 8 años hace | 28

| aceptada

Respondida
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...

más de 8 años hace | 1

| aceptada

Respondida
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...

más de 8 años hace | 1

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 1

| aceptada

Respondida
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...

más de 8 años hace | 1

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

más de 8 años hace | 0

| aceptada

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

más de 8 años hace | 0

| aceptada

Respondida
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 ...

más de 8 años hace | 1

| aceptada

Respondida
How can I create a matrix of black and white blocks given probability p of being black or white?
E.g., result = rand(10,10) < p;

más de 8 años hace | 0

Respondida
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...

más de 8 años hace | 0

Respondida
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...

más de 8 años hace | 1

| aceptada

Respondida
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...

más de 8 años hace | 0

| aceptada

Respondida
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)');

más de 8 años hace | 0

Respondida
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...

más de 8 años hace | 0

| aceptada

Respondida
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-...

más de 8 años hace | 0

Respondida
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: ...

más de 8 años hace | 0

Respondida
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 ...

más de 8 años hace | 1

| aceptada

Respondida
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...

más de 8 años hace | 0

Respondida
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 ...

más de 8 años hace | 0

Respondida
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...

más de 8 años hace | 1

Respondida
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 ...

más de 8 años hace | 2

| aceptada

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

más de 8 años hace | 0

| aceptada

Respondida
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),[]);

más de 8 años hace | 0

| aceptada

Respondida
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...

más de 8 años hace | 1

Respondida
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...

más de 8 años hace | 0

| aceptada

Respondida
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?

más de 8 años hace | 0

Cargar más