Community Profile # James Tursa

Last seen: Today Active 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.

#### Statistics

All
• • • • • • • • • • • #### Content Feed

View by

convert value from radian form to degree form
If you have values, then just number_in_radians = number_in_degrees * (pi/180); If you are working with trig functions, note t...

1 day ago | 0

Calculate taylor series using while loop
Looks like you are planning to use the identity ln(5) = ln((1/5)^-1) = -ln(1/5) and then use 1/5 as the x in the Taylor Series e...

2 days ago | 0

How to multiply row of matrix A with column of matrix B?
Maybe this is what you want? C = sum(A .* B.',2)

2 days ago | 0

Create variable with names of cell array

2 days ago | 0

just started matlab just wondering how to set up a 'for' loop
Here is an outline to get you started: x = _____; nmax = _____; result = 0; for n=1:nmax result = result + _____; end ...

4 days ago | 0

How can ı solve this triangle problem at MATLAB?
If you can find cos(x), you might look at feeding that into the acos( ) function to recover x.

4 days ago | 1

interpolation for 4cos(x) − ex = 0
Without seeing the text of your assignment, I would presume that this is the outline of what you are supposed to do: 1) Define ...

4 days ago | 1

| accepted

Solving a large number (thousands) of different "Ax=b" equations when the matrices A are all the same small size (3x3 to 6x6), but different numbers.
See this FEX submission by Bruno Luong: https://www.mathworks.com/matlabcentral/fileexchange/24260-multiple-same-size-linear-so...

6 days ago | 0

euler's method
Your code does not have enough states. You have a 2nd order ODE (the highest derivative present is 2), so the state vector need...

7 days ago | 1

Sum of series in matlab
You could use a simple matrix multiply for this (it looks like the x is the first row and the y is the second row): A = R(1,1:2...

8 days ago | 0

How does vrrotvec calculate rotation?
It is a simple algorithm that uses the cross product for the axis (normalized), and the dot product is used to calculate the ang...

10 days ago | 0

| accepted

How do I make a condition statement for an element that presents in two different arrays but is at the wrong position? This also applies to more than one elements
Assuming you have already made the check for the correct number in the correct spot, you can use this ismember(final_code_guess...

10 days ago | 0

MATLAB determine if matrices are invertible or not
You can use rank( ) for this: https://www.mathworks.com/help/matlab/ref/rank.html?searchHighlight=rank&s_tid=srchtitle_rank_1 ...

10 days ago | 1

Using Trapezodial rule Matlab
The trapezoid rule is for situations where you know the function values in advance, but you don't have this situation. I.e., if ...

12 days ago | 0

fortran subroutine includes several other subroutines
Note that the timestwo.F example that comes with MATLAB is a bad example of Fortran code. It has several bugs in it that could l...

14 days ago | 1

Call C/C++ Code from MATLAB Code
If your code includes a file called MyStruct.h, then yes you should have such a file. I would expect it to be something like th...

15 days ago | 0

Matlab tries to use mex files not on search path
You should use debugging to find out why this is happening. Type the following at the command line: dbstop if error then run y...

15 days ago | 0

| accepted

MATLAB: failed creating a diagonal matrix
You probably have inadvertently created a variable named 'diag' in your workspace, and hence diag(x) is simply indexing into thi...

15 days ago | 0

For-loops are now faster than some of the simplest vectorized statements. Why do we still need so much deep copying?
I have read rumors in the past that TMW was tinkering with the idea of sub-array references, or some type of limited pointer cap...

16 days ago | 1

| accepted

what correction is required in the code?
If the homework assignment specifies you must use a loop, then I don't think the intent was for you to wrap a simple i=1 range a...

16 days ago | 0

I am trying to solve 3rd order ode by RK45, but I did not get solution and plot, kindly fix my issues
The image appears to show seven equations (H1', H2', ..., H7') with boundary conditions at 0 and infinity. The RK45 scheme you ...

16 days ago | 0

| accepted

If statement in loop with AND OR operands
The problem is that the comparison Outcome{j} == '11_right' is an array comparison, not a scalar comparison. I.e., the string i...

16 days ago | 0

| accepted

How to create a equally distributed batting order for little league baseball team
Start with a simple pattern that works, and then randperm both the rows and columns. E.g., B = zeros(10); for k=1:10 % start w...

21 days ago | 0

| accepted

Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-2
Does this do what you want: Xindex(r, :) = [index rowidx]; You can get rid of c altogether since it isn't needed. And you nee...

24 days ago | 1

| accepted

How do I store a string from a MATLAB structure into a C structure in a MEX file?
Please show us the definitions of the variables involved. How large is cstructu->Field1, cstructu->Field2, and cstructu->Field3?...

25 days ago | 0

| accepted

How to calculate sum(A .* (B * C), 'all') [Ed. actually sum(A .* log(B * C), 'all')] efficiently when A is sparse and B*C is full and large?
Here is the straightforward mex code (i.e., no parallel sections) if you want to try it out. It computes the result directly in...

26 days ago | 3

| accepted

what does the expression " if ( ) && ( ) " do

28 days ago | 0

| accepted

How to calculate sum(A .* (B * C), 'all') [Ed. actually sum(A .* log(B * C), 'all')] efficiently when A is sparse and B*C is full and large?
You could use this loop to avoid the memory usage, but it will run slowly because of the data copying going on in the background...

29 days ago | 0