답변 있음
How can I fix this error?
Delete the extra closing parentheses. I.e., delete the paren where the red underline is.

5년 초과 전 | 0

답변 있음
Undefined function or variable t
Put this code in a separate file called Math.m % file Math.m function dxdt=Math(t,x1) % function name x=x1(1) y=x1(2) z=x1(...

5년 초과 전 | 0

답변 있음
Generating a 4th order Runge-Kutta Integrator solver for the motion equation.
ode45( ) is not well suited to the orbit problem since the integration errors can systematically build up over time. You can tr...

5년 초과 전 | 0

답변 있음
ODE45 function for 3 Variables
This y0 = [0;0;0;0]; and this zF = 0; means that your derivative function will evaluate to 0 exactly, so the solution is 0 e...

5년 초과 전 | 0

답변 있음
Can anyone help?
Hint: Look at the results of this operation, and I think you can figure it out from there: x = [2;3;4]; % column vector y = 0:...

5년 초과 전 | 0

답변 있음
How binary Random number generation upto n nodes ?
Here is how to get your stated desired output, but this is not random at all: r = dec2bin(0:(2^L-1)) - '0';

5년 초과 전 | 0

| 수락됨

답변 있음
Undefined function or variable 'bisection'.
From the error message, it looks like you are calling the function using the name "bisection", but the actual name of the functi...

5년 초과 전 | 0

답변 있음
ODE45 in 3 dimensions with 6 initial conditions
I find it easier to keep the position elements together, and the velocity elements together, in the state vector. So I would de...

5년 초과 전 | 1

| 수락됨

답변 있음
Generate a Runge-Kutta Integrator solver for the orbital motion equation, when given the initial conditions. Execute for 500 seconds.
First, I find it easier to keep the position elements together, and the velocity elements together, in the state vector. So I w...

5년 초과 전 | 1

| 수락됨

답변 있음
Runge-Kutta method, cannot produce the correct graphs
You need to index x in your calculations. E.g., q1 = f(x(i),y(i)); q2 = f(x(i)+h, y(i)+h*q1); You should init...

5년 초과 전 | 0

| 수락됨

답변 있음
Working with an equation and variables from user.
You can construct a function handle as follows: f = str2func(['@(x,y)' str1]); You can then use this function handle to evalua...

5년 초과 전 | 0

| 수락됨

답변 있음
A matlab code that allows the user to put inputs as
See the input( ) function for getting input from the user: https://www.mathworks.com/help/matlab/ref/input.html?searchHighlight...

5년 초과 전 | 0

답변 있음
Using a for loop determine how many months it would take to acquire £500,000.
You don't know the number of iterations it will take, so that is your clue that a for-loop is not appropriate. Use a while-loop...

5년 초과 전 | 0

답변 있음
User-defined function to perform Cramer's Rule
You made a good start. A and b should be inputs to your function, not outputs. Similarly, issquare is an internal test and sol...

5년 초과 전 | 0

답변 있음
Equation expansion using Symbolic Toolbox
This has been discussed on this forum before, and there is no easy solution to getting the Symbolic Toolbox to deal with non-com...

5년 초과 전 | 0

답변 있음
How to populate a cell array from another cell array?
It is not clear what elements you need extracted. But you can use regular indexing with cell arrays. E.g., result = m_test(1,...

5년 초과 전 | 0

| 수락됨

답변 있음
How to compile mex file
You are simply supposed to type (or copy & paste) that text into the command line at the > prompt. Just be in the directory whe...

5년 초과 전 | 0

답변 있음
Functions inputs/outputs
This is the signature of your Plot3D function: function Plot3D(Array32 ,str) As you can see, it doesn't return any outputs. B...

5년 초과 전 | 1

| 수락됨

답변 있음
Solve the system of equations using Cramer's Rule x+y+z=9,2x+5y+7z=52,.2x+y-z=0.
Original question: Solve the system of equations using Cramer's Rule x+y+z=9,2x+5y+7z=52,.2x+y-z=0. i want code for it And ...

5년 초과 전 | 0

| 수락됨

답변 있음
How to transpose a cell array blockwise?
E.g., brute force approach result = reshape([D{1};D{2};D{3}],[],1);

5년 초과 전 | 1

| 수락됨

답변 있음
Classical orbital elements Vectors
Use the norm( ) function instead of mag( ). E.g., norm(v) instead of mag(v). Calculate evec before you calculate e. Your evec...

5년 초과 전 | 0

| 수락됨

답변 있음
Why `mxGetField` could not be assigned to output of c mex?
The reason this crashes is because you have created a copy of an mxArray variable without telling the MATLAB Memory Manager that...

5년 초과 전 | 0

| 수락됨

답변 있음
Replace the diagonal with NaN in this 5x5 matrix
You could use linear indexing for the diagonal. E.g., assuming x is square you could add this line to your function: y(1:size(...

5년 초과 전 | 2

답변 있음
precision problem ? why ans for 10 ^ 5 * 0.0633 is 6.3299e+03
Normal floating point arithmetic effects. See this link: https://www.mathworks.com/matlabcentral/answers/57444-faq-why-is-0-3-...

5년 초과 전 | 0

답변 있음
Getting a random list of numbers on a very specific interval
Generate the list according to the range width of valid values, then adjust the results. E.g., r = rand(10000,1)*80; ix = r >...

5년 초과 전 | 0

| 수락됨

답변 있음
error using multiplication, incorrect dimensions
There are vectors in those equations, so maybe you just need to use element-wise operations: k1 = ((b.*(p+theta-n2).*c0+I.*(a.*...

5년 초과 전 | 0

답변 있음
Numeric integration for systems of vector equations
I haven't looked through your code, but from your description it sounds like you are making a fundamental error in your state sp...

5년 초과 전 | 0

| 수락됨

답변 있음
Preserving numerical symmetry in large nxn matrix
Here is a mex routine to do this calculation. It relies on inputting the diagonal matrix as a full vector of the diagonal eleme...

5년 초과 전 | 0

| 수락됨

답변 있음
Fast matrix multiplication with diagonal matrices
Here is a mex routine to do this calculation. It relies on inputting the diagonal matrices as full vectors of the diagonal elem...

5년 초과 전 | 1

| 수락됨

답변 있음
How to divide a vector randomly in 3 groups?
Based on my current understanding, maybe this rejection method might do what you want. Again, since there are only three groups...

5년 초과 전 | 1

| 수락됨

더 보기