Community Profile

photo

James Tursa


Last seen: Today
3 336 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

  • Master
  • Personal Best Downloads Level 3
  • First Review
  • 5-Star Galaxy Level 5
  • First Submission
  • 36 Month Streak
  • Thankful Level 2
  • Revival Level 2
  • Knowledgeable Level 4
  • First Answer
  • Solver

View details...

Contributions in
View by

Answered
How to multiply each numeric element in a cell array with a given number
Do you mean something like this? >> C = {'text'; 1; 1:2; 1:3} C = 4×1 cell array {'text' } {[ 1]} {...

2 dagar ago | 0

Answered
how do I locate a question I asked a few days ago?
If you are already on the Answers page, just click on the "My MATLAB Answers" dtop-down menu at the top and select "My Questions...

4 dagar ago | 0

Answered
Combining results of a 3D array
Is any(S,3) what you want?

4 dagar ago | 0

| accepted

Answered
Help with ODE45
G1 and G2 are symbolic expressions. ode45( ) is a numeric solver. You will need to turn G1 and G2 into actual non-symbolic cod...

4 dagar ago | 0

| accepted

Answered
Proof that sum of all positive integers is -1/12
This has nothing to do with MATLAB and numerical sums. You can pretty much get any answer you want by manipulating divergent se...

5 dagar ago | 3

| accepted

Answered
Using ode45 to solve odes from a matrix
F = [-f1 f1 0 0; 0 -f2 f2 0; 0 0 -f3 f3; v 0 0 -v].'; f = @(t,y) F * y;

6 dagar ago | 1

| accepted

Answered
Differentiating within a for loop
I assume by "three times" what was meant was diffferentiate the results iteratively three times, not differentiate the original ...

7 dagar ago | 0

Answered
Coding fibonacci without using fibonacci matlab code
Hint: The fprintf( ) function will automatically wrap around if you have too many variables than the format string allows for. E...

10 dagar ago | 0

Answered
How do I fill a matrix of 1s and 0s with sequential numbers
nnza = nnz(A); nnzb = nnz(B); At = A'; Bt = B'; At(logical(At)) = 1:nnza; Bt(logical(Bt)) = (nnza+1):(nnza+nnzb); Aresult ...

10 dagar ago | 0

| accepted

Answered
How to quickly find the column index of the last non-zero element in all rows in a sparse matrix?
You can use a mex routine for this and avoid all temporary data copies. E.g., a direct approach: /* File: find_last_nz.c *...

10 dagar ago | 3

Answered
How can I find the difference between values in an array with an index spacing of 2?
Hint: Look at x(1:2:end) and x(2:2:end). If x has an even number of elements, you could reshape(x,2,[]) and then look at some ...

11 dagar ago | 0

Answered
How can I print the result of a function using fprintf? (matrix and string!)
When comparing strings, it is not a good idea to use the == operator, which is an element-wise operator. Instead, use a string ...

11 dagar ago | 2

Answered
Voltage of a capacitor as a function of time
Maybe the function you want is cumsum( ) instead of sum( )?

11 dagar ago | 0

| accepted

Answered
Pythagorean Triples with Loops
E.g., an outline % (1) insert code here to ask for the largest value n for a=1:n for b=a:n for c=b:n ...

12 dagar ago | 0

Answered
Describing the motion of a composite body using system of second order differential equations
In this line: xy(2)=x(2)*x(2)*tan(x(1))-xy(4)*4*sec(x(1)); you are using xy(4) before it is defined. That is, you have t'' d...

12 dagar ago | 0

| accepted

Answered
Quaterion Creation In Simulink
See these posts for discussions of the MATLAB quaternion convention: https://www.mathworks.com/matlabcentral/answers/352465-wha...

12 dagar ago | 0

| accepted

Answered
rotate acceleration vector using rotation matrix
You can use a loop, e.g. acc = your 940x3 matrix r = your 3x3x940 array result = zeros(size(acc)); for k=1:size(acc,1) ...

12 dagar ago | 0

| accepted

Answered
C MEX file issue in for loop
These lines do not do what you think they do: double* data : ... data[j,i] ... From your code it is obvious that you thi...

13 dagar ago | 0

| accepted

Answered
Why 0.35 divide 0.001 return double, and 0.34 divide 0.001 return int.
Welcome to the world of floating point arithmetic. In one case, the result is 340 exactly so it prints without any trailing 0's...

13 dagar ago | 2

Submitted


SHAREDCHILD creates a shared data copy of contiguous subset
SHAREDCHILD creates a shared data copy of a contiguous subsection of an existing variable

16 dagar ago | 5 downloads |

Answered
Stop value in loop for repeating
Not sure if you need the numbers to be different or not. Either this: for k=i:length(myprime) or this for k=i+1:length(myprim...

17 dagar ago | 0

| accepted

Answered
Simplifying complex multiplications by means of polar coordinates
It looks like your accumulation is trying to sum polar coordinates. You can't do that. I.e., if you have (r1,theta1) and (r2,t...

17 dagar ago | 0

Answered
How to put a name on each double variable in a cell array"
You could have an associated cell array for the file names. E.g., fnames{i,j} = fn;

17 dagar ago | 0

| accepted

Answered
2nd Order ODE
For a numerical solution, you could try this function: https://www.mathworks.com/help/matlab/ref/bvp4c.html

18 dagar ago | 1

Answered
Converting Parameter from mxArray to a C-Style String
If it is a single quote ' ' char array, then just char *cp; cp = mxArrayToString(prhs[2]); If it is a double quote " " string...

18 dagar ago | 0

Answered
HOW to create 4D array and 3D array
Fortran allows negative and 0 indexing, but MATLAB does not. There is no double class equivalent of this in MATLAB. You would ...

19 dagar ago | 0

Answered
How to combine matrices
This sounds like a job for cell arrays. E.g., read here: https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-va...

19 dagar ago | 1

Answered
Adding a vector in a system of differential equations
One way is to create a function handle to pass in the extra parameters. E.g., function [output] = DiffEquations(time,init,iapp...

19 dagar ago | 0

Answered
Index in position 1 is invalid. Array indices must be positive integers or logical values?
If you are trying to create an anonymous function, the syntax is: f = @(u,v) (sin((B*Lx)*u)/((B*Lx/2)*u))*(sin((B*Ly)*v)/((B*Ly...

19 dagar ago | 1

Answered
Question about using randperm in a loop
If you want each number in the matrix to be unique, then don't call randperm( ) by row because that will not guarantee uniquenes...

20 dagar ago | 1

Load more