Respondida
Output argument "variable" (and maybe others) not assigned during call to "function".
Your code is calling a function named "u" and that function is not returning a value, so nothing gets assigned to val. What does...

más de 8 años hace | 0

| aceptada

Respondida
I have two matrices that are related and I need to sort one matrix while sorting the corresponding matrix the same way.
E.g., >> A = [3, 5, 2, 7, 8; 2, 3, 7, 3, 4; 7, 3, 2, 6, 2]; >> B = [1, 0, 1, 1, 0; 1, 1...

más de 8 años hace | 0

| aceptada

Respondida
Is it possible to utilise ODE45 in a for loop with indices?
To my reading of the problem, your state vector is a single z vector with indexing 1,...N. Is this correct? So if we start w...

más de 8 años hace | 1

| aceptada

Respondida
Bisection Method - Multiple roots
You need to provide different starting positions that bracket only one root at a time. In general you can't guarantee which root...

más de 8 años hace | 0

Respondida
Making a 3d array with an index that unifies all three layers
x = your 3d array k = your index result = x(k,k,:); % the three pieces of info at index k or, depending on how you wa...

más de 8 años hace | 0

| aceptada

Respondida
Create a row vector with specific condition
What's wrong with the first method you propose? rowVect = [x y y y y y]; If you want to generalize it (maybe you don't k...

más de 8 años hace | 2

| aceptada

Respondida
How can I pass an array as argument to a function; and update the contents of the array and return it to the calling function. how do I do it?...Can anyone help me? Thanks in adbvance
In the caller: x = myfunction(x); In your function: function x = myfunction(x) x = whatever;

más de 8 años hace | 0

| aceptada

Respondida
Why do i keep getting Index exceeds matrix dimensions and that there is an error in my dx(3) line
You don't tell us how you are calling ode45 (I presume), so we can only assume that the incoming state vector x has only two ele...

más de 8 años hace | 0

Respondida
Access current value ode45
Some issues with your code: 1) You don't pass the state vector into your derivative routine! E.g. in this line: [t,x]=od...

más de 8 años hace | 0

| aceptada

Respondida
Using end as argument to function
Weird, but it does match the doc for end: _"... end = (size(x,k)) when used as part of the kth index ..."_ E.g., >> f...

más de 8 años hace | 0

| aceptada

Pregunta


R2018a complex interleaved data is the new memory model
This is a heads up for mex programmers that work with complex data. According to the Release Notes, it appears that MATLAB R2018...

más de 8 años hace | 2 respuestas | 0

2

respuestas

Respondida
Solving Coupled ODE's with Runge Kutta.
Do it the same way the examples for ode45 do it in the doc. Let your state vector be two elements with y(1) = your original...

más de 8 años hace | 0

Respondida
Standard arithmetic operators and interleaved complex numbers in mex
It looks like you need to work with the real & imag data elements individually from this page of the doc: <https://www.mathwo...

más de 8 años hace | 0

Respondida
Standard arithmetic operators with interleaved complex API?
It looks like the latter from this page of the doc: <https://www.mathworks.com/help/matlab/matlab_external/handling-complex-d...

más de 8 años hace | 0

Respondida
MEX Fortran routines crashing
*NEVER, EVER* use literal integer constants as input arguments to the MATLAB API library functions in Fortran! You can never gua...

más de 8 años hace | 0

Respondida
A good way to test uniform random number
Not sure what the real goal is here. There are lots of uniform random number generator tests that you can use, and you will get ...

más de 8 años hace | 0

Respondida
How to run saved code?
Generally you simply copy the unzipped files to a folder that is on the MATLAB path (e.g., your current working folder). Then MA...

más de 8 años hace | 0

Respondida
im not getting the following error .Matlab file is attached
You could get this error if im_n is a matrix that does not have im_sz(2) number of columns.

más de 8 años hace | 0

| aceptada

Respondida
I have been assigned homework that ask me to make a script that calls a function. The function is a separate file from my script. I would like to know how to do this.
E.g., in your script file, you should have a line that looks something like this: y = MoveAve(x); % x is the input and y is...

más de 8 años hace | 0

| aceptada

Respondida
Two Stage Rocket zeroing a value and indices must be a positive real interger?
In this line: hs13 = hs1bo+vs1bo(t1-ts1bo)-0.5*g0*((t1a-ts1bo).^2); This vs1bo(t1-ts1bo) was probably meant to b...

más de 8 años hace | 0

Respondida
Decimal numbers in a triple for loop
Have you inadvertently created a variable with the name 'exp' in your workspace? If so, clear it and don't use that name for a v...

más de 8 años hace | 0

Respondida
How to find the minimum value in a row of an array that is not equal to zero
B = A; B(B==0)=inf; result = min(B,[],2);

más de 8 años hace | 0

Respondida
how i convert (0.345346329292023) to 1-sqrt(3/7)
I don't think you are going to be able to do this in general. The Symbolic Toolbox can help with some simple forms involving squ...

más de 8 años hace | 1

Respondida
Good Day Sir/Ma'am. May i ask what is the meaning of ode45 here and @dfunc? --------> [t,x] = ode45(@dfunc, tspan, x0);
ode45 is a numerical integration routine doc ode45 @dfunc is a function handle that points to a function called dfunc. T...

más de 8 años hace | 0

| aceptada

Respondida
How do I solve the differential equation numerically which is of the form : (z"/[1+(z')^2]^(3/2))+(0.1928529/x)=2+(50.99203)*z ? I need to get the x and z values.
Start with this: (z"/[1+(z'​)^2]^(3/2)​)+(0.19285​29/x)=2+(5​0.99203)*z Solve for the highest order derivative z" z...

más de 8 años hace | 0

| aceptada

Respondida
For and Break Stuck
It is often better to use tolerances for floating point comparisons, unless you wrote the underlying code and you *know* that th...

más de 8 años hace | 0

Respondida
Simple Method for Finding if ANY NaN values occur in a matrix.
Short of a mex routine that can avoid the creation of a potentially large intermediate array, I think you are stuck with isnan( ...

más de 8 años hace | 2

| aceptada

Pregunta


When I first learned programming ...
Tell your early programming stories here! Here is one of mine ... I attended a small college in Idaho (now Northwest Nazaren...

más de 8 años hace | 3 respuestas | 1

3

respuestas

Respondida
Adding a variable to a square zeros matrix given x and y coordinates calculated from separate vectors
It is unclear what the M matrix is supposed to be, but is this what you need? M(classpos,truepos) = 1;

más de 8 años hace | 1

| aceptada

Respondida
Error-"Index exceeds matrix dimensions"
You need to examine A and determine why it is not the size you expected. E.g., at the command line type this: dbstop if err...

más de 8 años hace | 0

Cargar más