Respondida
Inserting a column in a matrix before adding it to another matrix in a loop
C = [A,[B1;B2;B3]];

casi 6 años hace | 0

Respondida
I need help solving a equation with the Runge-Kutta-Fehlberg adaptive step size method using ode45.
For Problem 2 and Problem 3, you should not be looping over any variables. You simply have a derivative function that you pass ...

casi 6 años hace | 0

Respondida
Wrapper to run 32-Bit mex files on 64-Bit MATLAB
32-bit mex files are not standalone code. They interact with 32-bit MATLAB library code which interacts with the 32-bit MATLAB ...

casi 6 años hace | 0

Respondida
Taylor series for sin(x) doesn't give the right answer above 34 radians
The larger x is, the more cancellation error you are going to get with the intermediate sums. It would be best to reduce the ra...

casi 6 años hace | 0

Respondida
code for eulers method help
This needs to be outside of and prior to your loop, and r needs a multiply operator: f=@(y)r*(1-(y/L))*y-((p*y^2)/(q+y^2)); Th...

casi 6 años hace | 1

Respondida
minutes to hour and minutes
Make mins a column vector, or use mins(:) in your function handle.

casi 6 años hace | 0

Respondida
syntax error using complex loops
Did you mean while c <= 19 For loops should be looping over a fixed number of iterations, not a logical condition. While loop...

casi 6 años hace | 0

Respondida
Create Array that reorders given values to have smallest first and largest last while maintaining the rest of the array.
That 2nd loop needs to run in reverse order. You need to bubble that smallest number which might be near the back all the way t...

casi 6 años hace | 0

Respondida
Need helping creating and solving for this equation: f(t)=4- t^2 e^(-3t)
Here is a basic outline to get you started: n = 100; % Number of elements t = zeros( you fill this in ); % create an t vector ...

casi 6 años hace | 0

Respondida
How can I use a for loop to create new variables?
You might consider automatic array expansion. E.g., look at this result: t = 0:0.01:10; % row a = [0.1 1 3]'; % column y = e...

casi 6 años hace | 1

Respondida
Can someone convert this to matlab code?
So, you don't need any loops for this. Just use the automatic array expansion feature. E.g., take a look at what happens with ...

casi 6 años hace | 0

Respondida
Two variables need to be connected to one struct variable.
What about something like this: Results.First_Name = first_name{target}; Results.Last_Name = last_name{target}:

casi 6 años hace | 0

| aceptada

Respondida
How would I write the function of f(x)=sin(x)*exp(-x/10)
The multiply. E.g., f = @(x) sin(x) .* exp(-x/10); You don't need it on the divide because you are dividing by a scalar.

casi 6 años hace | 1

Respondida
Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'.
This is often caused by using a matrix or vector in an equation when you thought you were using a scalar. E.g., take these lines...

casi 6 años hace | 0

| aceptada

Respondida
Reading 64 bit words
Try reading and keeping the type as uint64 (using the *) instead of converting to double: word = fread(fid,1,'*uint64');

casi 6 años hace | 0

| aceptada

Respondida
mex, error C3861: "mxGetDoubles": Cannot find the identifier, "mxGetUint8s": Cannot find the identifier ?
Those functions are for the R2018a memory model API. For that, you need to add the -R2018a option flag: mex myfile.cpp -R2018a...

casi 6 años hace | 2

| aceptada

Respondida
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
You are missing an ending parenthesis, and also you probably need to use element-wise multiply: u3 = exp(-0.89*t) .* (1.75*cos(...

casi 6 años hace | 0

| aceptada

Respondida
Solving a nonlinear ODE
Step 1: Solve your ODE for the highest order derivative, in this case Rdoubledot (on paper) Rdoubledot = stuff (you figure thi...

casi 6 años hace | 0

Respondida
Computational Complexity of matrix multiplication
This question is perhaps more involved than it looks on the surface, because by default MATLAB doesn't store the imaginary part ...

casi 6 años hace | 0

| aceptada

Respondida
error:All functions in a script must be closed with an 'end'.( kindly see the code and help me to remove the error)
Looks like maybe this for iy = 1:H end for ix = 1:W should be just this for iy = 1:H for ix = 1:W Side Note: This would b...

casi 6 años hace | 0

Respondida
Using the euler method
p(ip) is the value of p at time t(ip). p isn't a function that you are passing time into like you are doing with p(t(ip)). So ...

casi 6 años hace | 0

Respondida
Finding Nonzero Elements in a Vector
You need to wrap this statement with an if-test and only execute it if v(CurrentPosition) is non-zero: prod = prod * v(CurrentP...

casi 6 años hace | 0

Respondida
Markov Chain probability steady state
Hint: The probability of moving from one state to another state in n steps is P^n

casi 6 años hace | 0

Respondida
Factorial without the Command
You could use either use a loop to multiply all of the numbers from 1 to n, or use recursion to multiply n by the factorial of n...

casi 6 años hace | 0

Respondida
Inputs a Vector and Returns the Second Smallest Element
Your algorithm always replaces Smallest and SecondSmallest at each iteration. Does that make sense? E.g., if the current Smalle...

casi 6 años hace | 0

Respondida
help w code error
You need to index S: f = -0.5 /(2.1+S(i));

casi 6 años hace | 0

Respondida
Hex to float like python struct.unpack()
Could be a Big Endian vs Little Endian thing. E.g., inserting a swapbytes( ) step: >> hex = 'C956F53D' hex = 'C956F53D' ...

casi 6 años hace | 0

Respondida
Python to MATLAB accuracy
Probably not. The trailing bits of floating point calculations in general can't be trusted. It you change the order of the calc...

casi 6 años hace | 0

| aceptada

Respondida
solving coefficient with linear algebra
You basically have this: [ONES_COLUMN, X_COLUMN, Y_COLUMN] * p = DATA You know all the CAPS stuff. So just use the standard l...

casi 6 años hace | 0

Respondida
Composite Functions with a function with two ranges
For example, take the first one: (g o f)(x) This is just g(f(x)) which is g(x^2) Assuming we are talking only about real in...

casi 6 años hace | 0

Cargar más