Answered
How to change anonymous function to take array parameter and subject to ranges
You need to be careful with how you build your anonymous function: mu_x = @(t) f_lx(t,param); In the above line, t is an...

8 years ago | 0

| accepted

Answered
How to access elements of GF array in C++?
_"... but I'm trying to speed up my program by this C++ implementation ..."_ The MATLAB API has you hamstrung in this effort....

8 years ago | 1

| accepted

Answered
Attempted to access x(1,53); index out of bounds because size(x)=[1,2].
Type the following at the MATLAB command prompt: dbstop if error Then run your code. When the error occurs, the program ...

8 years ago | 2

Answered
How can I write the Twos complement and return a hex string ?
If you really have to write a for-loop for this, a simple algorithm for adding two 2's complement signed integers represented as...

8 years ago | 1

Answered
MEX gfortran type mismatch error
The only thing funny I see in your code at first glance are these function return type declarations: mwsize mxgetm, m...

8 years ago | 0

Answered
Why am I getting a parse error?
Please post the complete error message text, along with the offending line. I can only guess that maybe you have a variable name...

8 years ago | 0

Answered
While loop is not stopping at value.
This line yini=yini+(h*f); makes yini a vector, since f is a vector. Given that, is the following test which is operatin...

8 years ago | 0

Answered
I don't know Why my mex function associated with a Fortran 77 does not work. Can anybody help me?
1) "size" is the name of an intrinsic Fortran function that you shouldn't shadow. Pick a different name for your variable. 2)...

8 years ago | 0

| accepted

Answered
need to print a matrix with a string
Assuming there are three grades in the quiz field, maybe this will work for you fprintf('%s %d %d %d\n',student(i).lastn...

8 years ago | 0

Answered
datenum to UTC?
Are you just looking for how to convert from the former to the latter? E.g., s = '10-Oct-2013 15:59:00'; unix_m4 = (date...

8 years ago | 0

| accepted

Answered
How can I delete row based on the value of row (i) and row (i+1)
I _think_ this is what you are asking for (i.e., delete all rows that have equal neighbors in column 10): X = your matrix ...

8 years ago | 0

| accepted

Answered
how to transfer data from MATLAB to c++ using MEX
Here is some example code for you. It is written as a mex routine but you should be able to adapt the functions to your Engine a...

8 years ago | 0

| accepted

Answered
How do I create a column vector of random numbers with interval [-0.1;0.1], with N elements?
N = whatever de = whatever result = rand(N,1)*(2*de) - de;

8 years ago | 0

| accepted

Answered
Error out of memory
Type the following at the command line: dbstop if error Then run your code. When the error occurs, the code will pause w...

8 years ago | 0

Answered
Simple Math With Complex Arrays
So, MATLAB has functions i and j defined as the imaginary sqrt(-1) values. I notice that you are using i and j as indexing. This...

8 years ago | 0

Answered
output argument not assigned
Based on what you have posted, it appears var has more than 3 dimensions, so you aren't getting into your code above.

8 years ago | 0

Answered
My professor is driving me crazy.
Maybe he wants the results presented in columns? tmax = 50; step = 5; t = (0:step:tmax)'; % make it a column X = [...

8 years ago | 1

Answered
What is the solution of this problem? this is array 13*13
It means the pieces do not form a 13x13 matrix. That is what you need to fix.

8 years ago | 1

Answered
Simulating gravity, forces seem to be miscalculated (need help)
I don't have the time to step through your code, but I don't see where you set the sign of F as an attracting force. Maybe all y...

8 years ago | 0

Answered
How to add uniform noise with given range
lower_bound = something upper_bound = something n = number of samples u = lower_bound + rand(1,n)*(upper_bound-lower_...

8 years ago | 0

| accepted

Answered
representation of positive and negative number to binary 1 and 0 in matlab
result = volts > 0; This will give you a logical result. If you need the result to be double, then simply result = dou...

8 years ago | 1

Answered
Matlab if statements in physics
You can easily run the code to see that it clips the values outside of [-1,1] so that they stay in this range. But it appears th...

8 years ago | 1

| accepted

Answered
inv matrix command error
Normally the inv is applied to the left hand side coefficients, since people usually write the "A" matrix on the left and the "b...

8 years ago | 0

| accepted

Answered
Log equation log(x) not plotting correctly
Since you are trying to graph the inverse of the functions, you should be switching the domains as well when you generate the po...

8 years ago | 0

Answered
How do I implement cosd in simulink
You could use a MATLAB Function block, or perhaps scale the input prior to going into a sin block.

8 years ago | 0

Answered
Orbit by euler's method
I don't see anything obviously wrong with your code. So other possibilities to consider are: - The step size is too large for...

8 years ago | 0

Answered
Use a "while" loop to create the vector x = [4 16 28 40]. Note the constant increment of 12.How can i put the ic values in x.Help please
You need something inside the while loop that sets the value of the x elements. E.g., k = 1; while ic < 40 x(k) = ...

8 years ago | 1

| accepted

Answered
error in Euler method
You need to recalculate the derivatives at _each_ time step. So all of the stuff that goes into calculating dX needs to be insid...

8 years ago | 0

| accepted

Answered
Unusual slowdown using sum.
Are you pre-allocating Grandarray?

8 years ago | 0

Load more