Community Profile

photo

James Tursa


2,822 total contributions since 2007

Interested in external applications, mex & engine applications with Fortran, C, C++, etc, particularly in the areas of speed improvement and memory management efficiencies.

Contact

James Tursa's Badges

  • 36 Month Streak
  • Thankful Level 2
  • Ace
  • Revival Level 2
  • Knowledgeable Level 4
  • First Answer
  • Solver

View details...

Contributions in
View by

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

1 day ago | 0

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

1 day ago | 0

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

2 days ago | 0

| accepted

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

2 days ago | 0

| accepted

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

2 days ago | 0

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

3 days ago | 2

| accepted

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

3 days ago | 0

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

4 days ago | 0

| accepted

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

4 days ago | 0

| accepted

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

4 days ago | 0

| accepted

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

5 days ago | 1

| accepted

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

5 days ago | 0

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

5 days ago | 1

| accepted

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

7 days ago | 0

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

8 days ago | 1

Answered
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) ...

8 days ago | 1

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

8 days ago | 0

| accepted

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

8 days ago | 0

Answered
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);

8 days ago | 1

| accepted

Answered
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) ...

9 days ago | 0

| accepted

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

9 days ago | 0

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

10 days ago | 1

| accepted

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

15 days ago | 1

| accepted

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

15 days ago | 1

| accepted

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

15 days ago | 0

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

15 days ago | 0

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

19 days ago | 1

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

26 days ago | 0

| accepted

Answered
How do I use either "printf()" or "mexPrintf()" when either call gets me "Unknown function or variable"?
Typically use disp( ) or display( ) or fprintf( ) to display variables in the command window.

26 days ago | 0

| accepted

Load more