Respondida
Finding all integer vectors between two vector bounds
You can use the FEX submission allcomb( ) by Jos for this: c = arrayfun(@(a,b)a:b,lb,ub,'uni',false); result = allcomb(c{:}); ...

más de 7 años hace | 2

| aceptada

Respondida
Mex Code for Array Slicing
You are not going to get any performance boost for this in a mex routine. Since the m-code and the mex code both do deep data co...

más de 7 años hace | 0

| aceptada

Respondida
Variables not displaying in workspace
The variables v, j, and heartrate are local variables and only exist inside the function MyHeartRateOG workspace. Once this func...

más de 7 años hace | 2

Respondida
how can i get an improved Euler's method code for this function?
The "Modified" Euler's Method is usually referring to the 2nd order scheme where you average the current and next step derivativ...

más de 7 años hace | 1

Respondida
Making a for loop that appends outputs in a matrix/array
"... I thought about making 33 different matrices (one from each output) and then combining them at the end but this seems count...

más de 7 años hace | 0

| aceptada

Respondida
How to use CROSS with 3x1 Matrix on a 3xN Matrix
Unfortunately, the cross( ) function does not auto-expand the dimensions of the operands. So you would have to manually do this ...

más de 7 años hace | 0

| aceptada

Respondida
Applying 3D Rotation Matrix
You can use this FEX submission by Matt J with your coordinate axes as the inputs to get the rotation matrix R: https://www.mat...

más de 7 años hace | 0

| aceptada

Respondida
plotting projectile with drag
When doing physics problems, I would advise that you always include units and description in a comment off to the side to make s...

más de 7 años hace | 0

| aceptada

Respondida
How to run Main.mexa64
As long as Main.mexa64 is on your path so MATLAB can see it: t = Main(a);

más de 7 años hace | 0

Respondida
Appending Arrays at the END!
E.g., A = B * C.'; % outer product A = A(:); % turn into column vector

más de 7 años hace | 2

| aceptada

Respondida
How to make a QuickSort for 2 vectors?
See the 2nd output of the sort( ) function, and use that as an index to rearrange your signal. E.g., [t,x] = sort(time); s = s...

más de 7 años hace | 0

Respondida
Help me use this formula to complete this task (Runge–Kutta methods)
First, your derivative function should be obtained from your differential equation, not from the solution as you have it. You we...

más de 7 años hace | 0

| aceptada

Respondida
Numerical Logical Statement Error
Both of your numbers are negative, so I don't think this test does what you intended. E.g., >> ct = 1; >> Us = -1.7280e+03 Us...

más de 7 años hace | 0

| aceptada

Respondida
I get an Access violation reading location when using mxCreateCharMatrixFromStrings
You should show the entire code you are using, not just a snippet of it. Also, the fact that you have a typo in the function nam...

más de 7 años hace | 0

| aceptada

Respondida
I need help solving an ODE using the Runge Kutta method. The values I obtain for "A" are correct, but the value I receive for "C" are incorrect.
Your signature of the derivative function is f2(A,C,t) not f2(A,t,C). So these lines: k6(k) = dt*f2((A(k)+0.5*k1(k)),t(k)+0...

más de 7 años hace | 1

| aceptada

Respondida
For loop not working. Array indices must be positive integers or logical values.
This line on the first iteration when i=1 and j=1: y(j) = y +(1/(M+1))*x(i-j); You are indexing x(0). Also, you are trying to ...

más de 7 años hace | 1

Respondida
Binary Vector Frequency of 1's
b = your row vector of 1's and 0's result = cumsum(b) ./ (1:numel(b));

más de 7 años hace | 1

| aceptada

Respondida
sum all columns in a matrix
Hint: Look at matrix multiplication.

más de 7 años hace | 0

Respondida
How to have multiple matlab instances access MEX function files
Multiple instances of MATLAB can certainly access and run the same mex routine. But based on the fact that you have a LINK erro...

más de 7 años hace | 1

| aceptada

Respondida
How to put 2 vectors when the inner product is available
I'm not at all sure what you mean. Maybe this is what you want: result = 2*u(1)*v(1) - 3*u(1)*v(2) - 3*u(2)*v(1) + 5*u(2)*v(2) ...

más de 7 años hace | 1

Respondida
How can i solve equation but adding a constant (d^2u/dt^2)+4*(du/dt)-(3*u)+5=0)
The general solution is the homogeneous solution (to the "= 0" equation) which you already have plus any particular specific sol...

más de 7 años hace | 0

| aceptada

Respondida
Finding real root of Newton's cubic
The third line: x(0) = 1; You have a 0 index. You need to start your indexing with 1, not 0. You've got other issues with you...

más de 7 años hace | 0

Respondida
How to multiply part of a matrix with another matrix
result = M1 .* M2(:,1:2); If you want to replace part of M2 with this result, then simply M2(:,1:2) = M1 .* M2(:,1:2);

más de 7 años hace | 1

| aceptada

Respondida
I am getting an error in function definition.
gen_Kalman_coefs needs to have the proper function syntax. E.g., function [Kph, Kf] = gen_Kalman_coefs (R, Q, S0, F, G, H, N) ...

más de 7 años hace | 0

| aceptada

Respondida
matrix multiplication dimension issues
If the formula in the article has the calculation as async = spect1(:, 2:n) * N * spect2(:, 2:n)'/(n-2) , and N is an (n-1)x(n-1...

más de 7 años hace | 0

Respondida
Using int64 for changing the data class
int64(x), where x is is a shorter signed or unsigned integer class, will effectively attach the appropriate number of 0 bytes to...

más de 7 años hace | 1

| aceptada

Respondida
How to input and output variable in mex function
Some issues: b = mxGetPr(plhs[1]); d = mxGetPr(plhs[2]); The above lines crash MATLAB when you try to use...

más de 7 años hace | 1

| aceptada

Respondida
how to do bitxor operation of two 1*255 matrix
It's not entirely clear to me what operation you really want, but if the elements of h1 and h2 represent "bits", then you could ...

más de 7 años hace | 0

Respondida
Get x and y coordinates of motion from ode45
You've got a 4th order system (2 equations for x and y, each 2nd order --> 2 x 2 = 4), so your state vector will need to be 4 el...

más de 7 años hace | 2

| aceptada

Cargar más