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

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

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

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

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

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

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

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

7 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 = [...

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

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

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

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

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

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

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

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

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

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

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

7 years ago | 0

| accepted

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

7 years ago | 0

Answered
Trying to develop a program to implement Euler's Method for a second order system
Here's a start: Create a file called deriv.m in your working directory. Since you will have two first order equations, define...

7 years ago | 1

Answered
MATLAB Coder: Matrix-Scalar-Multiplication slower in generated code?
I'm only seeing about a 5% difference in timing when comparing the BLAS dscal function call to an explicit loop in my R2017b Win...

7 years ago | 0

| accepted

Answered
How to solve a first order ODE system with coupled equations
If you have these dependencies among the dy4/dt, dy5/dt, and dy6/dt terms, then you need to first solve for them uniquely. Just ...

7 years ago | 0

| accepted

Answered
Is there any way to display a row of a character vector?
Not sure if this is what you are asking: C = your 407 x 36 character matrix r = your row number result = C(r,:); % ro...

7 years ago | 2

| accepted

Answered
Problem with a function.
You need to pass s into your perimeter function: p = perimeter(s);

7 years ago | 0

| accepted

Answered
How to output a mexFunction input without copy
If you are returning a modified variable, then you basically have three choices: 1) Do it the way you were previously doing i...

7 years ago | 0

Answered
How do I convert this into a 2d matrix of 50x50 in Matlab?
_"... I copied the values from Matlab's command window directly …"_ That means it is a sparse matrix based on the format of ...

7 years ago | 1

| accepted

Answered
Index exceeds array bounds help - Fibonacci Series
_"... For this reason, since at the end we only need the (N)th and (N-1)th terms, we can delete all the other ones as the loop g...

7 years ago | 0

Answered
Major speed reduction (~50x) when doing multiple matrix multiply operations in a row. Is this a (major) bug? Any ideas for a fix?
You should not store your slices as follows, since this forces each slice to be scattered in memory and does not make efficient ...

7 years ago | 0

Load more