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

답변 있음

ODE45 to solve vector ode

You have a six element state vector. The y(1) and y(2) coming into your derivative function are not position and velocity vecto...

ODE45 to solve vector ode

You have a six element state vector. The y(1) and y(2) coming into your derivative function are not position and velocity vecto...

1일 전 | 0

| 수락됨

답변 있음

code in script called swap

You can adapt the three lines of code found here: https://www.tutorialspoint.com/learn_c_by_examples/swapping_two_numbers_using...

code in script called swap

You can adapt the three lines of code found here: https://www.tutorialspoint.com/learn_c_by_examples/swapping_two_numbers_using...

1일 전 | 0

답변 있음

Extract values common to 5 columns

Hint: Look at the result of diff(A,[],2). If all the values in a row are equal, what would you expect to be in the result of th...

Extract values common to 5 columns

Hint: Look at the result of diff(A,[],2). If all the values in a row are equal, what would you expect to be in the result of th...

1일 전 | 0

답변 있음

Element-wise power resulting in imaginary values and NAN

Looks like the problem calculation is being done in the background as exp(B.*log(A)), but I don't know why it does this sometime...

Element-wise power resulting in imaginary values and NAN

Looks like the problem calculation is being done in the background as exp(B.*log(A)), but I don't know why it does this sometime...

1일 전 | 0

| 수락됨

답변 있음

How to make a loop that writes in a new vector only values that meet a condition?

Assuming you don't want the first value since there is no previous value to compare to: x = [false, diff(VPo) > 0]; VPoF = VPo...

How to make a loop that writes in a new vector only values that meet a condition?

Assuming you don't want the first value since there is no previous value to compare to: x = [false, diff(VPo) > 0]; VPoF = VPo...

1일 전 | 0

| 수락됨

답변 있음

Out of Memory error when removing columns of a big matrix .

What are you doing with the matrix A downstream in your code? Even if the column removal worked, seems like you still might hav...

Out of Memory error when removing columns of a big matrix .

What are you doing with the matrix A downstream in your code? Even if the column removal worked, seems like you still might hav...

2일 전 | 0

답변 있음

Choose random element of vector

k = sort(randperm(numel(vector),2)); x1 = vector(k(1)); x2 = vector(k(2)); This assumes that you always want to be able to pi...

Choose random element of vector

k = sort(randperm(numel(vector),2)); x1 = vector(k(1)); x2 = vector(k(2)); This assumes that you always want to be able to pi...

2일 전 | 1

답변 있음

Angle betwen two 3d vectors in the range 0-360 degree

E.g., here is one method: function a = vecangle360(v1,v2,n) x = cross(v1,v2); c = sign(dot(x,n)) * norm(x); a = atan2d(c,dot...

Angle betwen two 3d vectors in the range 0-360 degree

E.g., here is one method: function a = vecangle360(v1,v2,n) x = cross(v1,v2); c = sign(dot(x,n)) * norm(x); a = atan2d(c,dot...

3일 전 | 0

| 수락됨

답변 있음

Internal variables not calculated

Maybe the behavior you are looking for is nested functions. Instead of a function at the end of a script, you have a function w...

Internal variables not calculated

Maybe the behavior you are looking for is nested functions. Instead of a function at the end of a script, you have a function w...

3일 전 | 1

답변 있음

Internal variables not calculated

You didn't declare those variables global in the caller. You only have them global in the function. Add the global statements ...

Internal variables not calculated

You didn't declare those variables global in the caller. You only have them global in the function. Add the global statements ...

4일 전 | 1

답변 있음

how can i resolve this equation Runge kutta method

You've got a 2nd order equation, so that means you need a 2-element state vector. The two states will be y and y'. All of your...

how can i resolve this equation Runge kutta method

You've got a 2nd order equation, so that means you need a 2-element state vector. The two states will be y and y'. All of your...

4일 전 | 0

답변 있음

Appending to an array/vector

We would need to see your code to give a more specific answer, but the general outline is to index into your result vector. E.g....

Appending to an array/vector

We would need to see your code to give a more specific answer, but the general outline is to index into your result vector. E.g....

5일 전 | 0

답변 있음

what wrong in my code when i use ode 45,and what the error are mean

Try changing this [t,y]=ode45('Mass_On_Stick_012345678',tSpan,y0,opts,Parameter); to this [t,y]=ode45(@(t,y)Mass_On_Stick_012...

what wrong in my code when i use ode 45,and what the error are mean

Try changing this [t,y]=ode45('Mass_On_Stick_012345678',tSpan,y0,opts,Parameter); to this [t,y]=ode45(@(t,y)Mass_On_Stick_012...

5일 전 | 1

| 수락됨

답변 있음

dgemv produces only zero vectors as results

Two things: 1) All of the integers that you are passing into BLAS/LAPACK functions should be the same. Why are you using ptrdi...

dgemv produces only zero vectors as results

Two things: 1) All of the integers that you are passing into BLAS/LAPACK functions should be the same. Why are you using ptrdi...

6일 전 | 1

| 수락됨

답변 있음

Create an .m file

To create an .m file for a function named randint, you can do this at the command line as long as the default directory is your ...

Create an .m file

To create an .m file for a function named randint, you can do this at the command line as long as the default directory is your ...

8일 전 | 0

답변 있음

How to read a binary file with below description?

E.g., fname = the name of your binary file fp = fopen(fname,'rb'); k = fread(fp,6,'int16'); y_start = k(1); y_end = k(2);...

How to read a binary file with below description?

E.g., fname = the name of your binary file fp = fopen(fname,'rb'); k = fread(fp,6,'int16'); y_start = k(1); y_end = k(2);...

9일 전 | 0

| 수락됨

답변 있음

Output argument is not assigned on some execution paths.

What happens if you change this elseif imbalance <= 0 to this else

Output argument is not assigned on some execution paths.

What happens if you change this elseif imbalance <= 0 to this else

9일 전 | 0

| 수락됨

답변 있음

Does this character vector match any of the following character vectors?

You could use cell arrays. E.g., use ismember(currentMonth,{'June','July','August'}) instead of strcmp(currentMonth,'June'||...

Does this character vector match any of the following character vectors?

You could use cell arrays. E.g., use ismember(currentMonth,{'June','July','August'}) instead of strcmp(currentMonth,'June'||...

9일 전 | 0

| 수락됨

답변 있음

I am getting wrong answer for factorial(22)

R2016a PCWIN64: >> a1 = factorial(22) a1 = 1.124000727777608e+21 >> b = (sqrt(2*pi*22))*(22^22/exp(22)) b = 1.11...

I am getting wrong answer for factorial(22)

R2016a PCWIN64: >> a1 = factorial(22) a1 = 1.124000727777608e+21 >> b = (sqrt(2*pi*22))*(22^22/exp(22)) b = 1.11...

11일 전 | 1

답변 있음

generating random values with condition

You could use this FEX submission by Roger Stafford for each 4 number block: https://www.mathworks.com/matlabcentral/fileexchan...

generating random values with condition

You could use this FEX submission by Roger Stafford for each 4 number block: https://www.mathworks.com/matlabcentral/fileexchan...

11일 전 | 0

답변 있음

How to Convert a function return is a Handle (C++ mex)

DEVICE_HANDLE is a pointer, so if you are running 64-bit MATLAB then DEVICE_HANDLE will be be 64-bits and will not fit in a 32-b...

How to Convert a function return is a Handle (C++ mex)

DEVICE_HANDLE is a pointer, so if you are running 64-bit MATLAB then DEVICE_HANDLE will be be 64-bits and will not fit in a 32-b...

16일 전 | 0

답변 있음

Runge kutta 4 with two ODE's - function inside a function

Since W is a function of time, it needs to match the time that you are using in each particular line of code. E.g., take this l...

Runge kutta 4 with two ODE's - function inside a function

Since W is a function of time, it needs to match the time that you are using in each particular line of code. E.g., take this l...

18일 전 | 1

| 수락됨

답변 있음

Converting output from 'find' into a logical

E.g., x = the result of the find y = false(22879,1); y(x) = true; But it may be better to create y with a direct logical exp...

Converting output from 'find' into a logical

E.g., x = the result of the find y = false(22879,1); y(x) = true; But it may be better to create y with a direct logical exp...

18일 전 | 0

| 수락됨

답변 있음

Remove all infinite values from ydata and then remove those same indices from the xdata so the vectors remain the same length

x = isinf(ydata); ydata(x) = []; xdata(x) = []; Or, if you need to extract the values into new variables, x = ~isinf(ydata);...

Remove all infinite values from ydata and then remove those same indices from the xdata so the vectors remain the same length

x = isinf(ydata); ydata(x) = []; xdata(x) = []; Or, if you need to extract the values into new variables, x = ~isinf(ydata);...

19일 전 | 0

답변 있음

Different results by changing the order of operations

You haven't broken up the calculations properly. I.e., you are comparing different calculations. Your code is essentially: ...

Different results by changing the order of operations

You haven't broken up the calculations properly. I.e., you are comparing different calculations. Your code is essentially: ...

20일 전 | 1

| 수락됨

답변 있음

Grabbing sections of a matrix by using two doubles as the index

E.g., result = arrayfun(@(x1,x2)data(x1:x2),find(indStart),find(indEnd),'uni',false); This assumes of course that the indStart...

Grabbing sections of a matrix by using two doubles as the index

E.g., result = arrayfun(@(x1,x2)data(x1:x2),find(indStart),find(indEnd),'uni',false); This assumes of course that the indStart...

약 1달 전 | 1

| 수락됨

답변 있음

1-2-1 or X-Y-X rotation matrix not supported

According to the doc here: https://www.mathworks.com/help/aerotbx/ug/angle2quat.html?s_tid=doc_ta The angle2quat supports the ...

1-2-1 or X-Y-X rotation matrix not supported

According to the doc here: https://www.mathworks.com/help/aerotbx/ug/angle2quat.html?s_tid=doc_ta The angle2quat supports the ...

약 1달 전 | 1

| 수락됨

답변 있음

Plotting a System of Two Second-Order Differential Equations

You've got a 4th order system, so your initial state must contain four elements including the x1' and x2', not two. E.g., [t, ...

Plotting a System of Two Second-Order Differential Equations

You've got a 4th order system, so your initial state must contain four elements including the x1' and x2', not two. E.g., [t, ...

약 1달 전 | 0

| 수락됨

답변 있음

hex2num can't recover value from the hex by num2hex

Try typecast(uint32(hex2dec('be361af6')),'single')

hex2num can't recover value from the hex by num2hex

Try typecast(uint32(hex2dec('be361af6')),'single')

약 1달 전 | 1