답변 있음
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...

7년 초과 전 | 1

답변 있음
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...

7년 초과 전 | 0

| 수락됨

답변 있음
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 ...

7년 초과 전 | 0

| 수락됨

답변 있음
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...

7년 초과 전 | 0

| 수락됨

답변 있음
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...

7년 초과 전 | 0

| 수락됨

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

7년 초과 전 | 0

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

7년 초과 전 | 2

| 수락됨

답변 있음
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...

7년 초과 전 | 0

답변 있음
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...

7년 초과 전 | 0

| 수락됨

답변 있음
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...

7년 초과 전 | 0

| 수락됨

답변 있음
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...

7년 초과 전 | 0

| 수락됨

답변 있음
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...

7년 초과 전 | 1

| 수락됨

답변 있음
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 ...

7년 초과 전 | 1

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

7년 초과 전 | 1

| 수락됨

답변 있음
sum all columns in a matrix
Hint: Look at matrix multiplication.

7년 초과 전 | 0

답변 있음
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...

7년 초과 전 | 1

| 수락됨

답변 있음
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) ...

7년 초과 전 | 1

답변 있음
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...

7년 초과 전 | 0

| 수락됨

답변 있음
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...

7년 초과 전 | 0

답변 있음
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);

7년 초과 전 | 1

| 수락됨

답변 있음
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) ...

7년 초과 전 | 0

| 수락됨

답변 있음
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...

7년 초과 전 | 0

답변 있음
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...

7년 초과 전 | 1

| 수락됨

답변 있음
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...

7년 초과 전 | 1

| 수락됨

답변 있음
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 ...

7년 초과 전 | 0

답변 있음
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...

7년 초과 전 | 2

| 수락됨

답변 있음
Im having trouble with the forward eulers method.
A basic outline would be: dt = _____; % the step size, you fill this in n = _____: % number of steps, you fill this in x = ze...

7년 초과 전 | 0

답변 있음
speed up run time of mldivide function.
You might want to take a look at the Tim Davis Factorize FES submission: https://www.mathworks.com/matlabcentral/fileexchange...

7년 초과 전 | 1

답변 있음
MATLAB returns empty string from C-MEX file
It is hard to believe that this code did not crash MATLAB. The issues: char *code; <-- This is an uninitialized pointer .....

7년 초과 전 | 0

| 수락됨

더 보기