답변 있음
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...

대략 8년 전 | 0

| 수락됨

답변 있음
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...

대략 8년 전 | 2

| 수락됨

답변 있음
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;

대략 8년 전 | 0

| 수락됨

답변 있음
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...

대략 8년 전 | 0

답변 있음
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...

대략 8년 전 | 0

| 수락됨

답변 있음
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...

대략 8년 전 | 0

| 수락됨

질문


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

대략 8년 전 | 답변 수: 2 | 0

2

답변

답변 있음
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...

대략 8년 전 | 0

답변 있음
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...

대략 8년 전 | 0

답변 있음
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...

대략 8년 전 | 0

답변 있음
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...

대략 8년 전 | 0

답변 있음
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 ...

대략 8년 전 | 0

답변 있음
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...

대략 8년 전 | 0

답변 있음
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.

대략 8년 전 | 0

| 수락됨

답변 있음
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...

대략 8년 전 | 0

| 수락됨

답변 있음
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...

대략 8년 전 | 0

답변 있음
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...

대략 8년 전 | 0

답변 있음
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);

대략 8년 전 | 0

답변 있음
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...

대략 8년 전 | 1

답변 있음
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...

대략 8년 전 | 0

| 수락됨

답변 있음
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...

대략 8년 전 | 0

| 수락됨

답변 있음
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...

대략 8년 전 | 0

답변 있음
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( ...

대략 8년 전 | 2

| 수락됨

질문


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

대략 8년 전 | 답변 수: 3 | 1

3

답변

답변 있음
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;

대략 8년 전 | 1

| 수락됨

답변 있음
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...

대략 8년 전 | 0

답변 있음
Parse error in function
Separate those two statements. E.g., this outer_rad = inner_rad && inner_rad = outer_rad; should be this temp = out...

대략 8년 전 | 0

| 수락됨

답변 있음
how can i use randperm without involving a certain unknown number.
One way: n = 10; N = 1:n; x = randi(n); N(x) = []; p = N(randperm(numel(N),2));

대략 8년 전 | 1

답변 있음
how to add 2 to some of array's elements?
a(3:end) = a(3:end) + 2;

대략 8년 전 | 2

| 수락됨

답변 있음
Simultaneous solving of the system of ordinary differential equations
The doc for ode45 shows examples of 2nd order ODE systems. E.g., look at this link <https://www.mathworks.com/help/matlab/ref...

대략 8년 전 | 0

| 수락됨

더 보기