답변 있음
Math function and plotting
You need to change that matrix divide operator / to an element-wise divide operator ./ with the dot.

대략 6년 전 | 1

답변 있음
How can I find the position of a real number in a vector?
Welcome to the world of floating point arithmetic. The number you are searching for cannot be represented exactly in IEEE doubl...

대략 6년 전 | 0

| 수락됨

답변 있음
Runge Kutta 4th Order Method
When solving the EOM for w_dot you should get a minus sign: https://en.wikipedia.org/wiki/Euler%27s_equations_%28rigid_body_dyn...

대략 6년 전 | 0

답변 있음
How to tell if a value is an integer?
Welcome to the world of floating point arithmetic. (77/29) cannot be represented exactly in IEEE double precision arithmetic, s...

대략 6년 전 | 1

답변 있음
Boolean help with arrays
You have incorrect syntax. First a big hint: A(:) turns A into a column vector containing all of the elements in a column orde...

대략 6년 전 | 0

| 수락됨

답변 있음
How to generate a vector of random numbers whose total must be equal to 1?
See this FEX submission by Roger Stafford: https://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-...

대략 6년 전 | 0

답변 있음
ode45 dynamics rocket around earth equation of motion
You have the wrong initial conditions. They should be: r0 rdot0 theta0 thetadot0 But you have vtheta0 in that last spot in...

대략 6년 전 | 3

| 수락됨

답변 있음
how to extract n rows in a matrix column iteratively?
Depending on what you are doing downstream in your code, it may make more sense to simply reshape and then access the columns. ...

대략 6년 전 | 0

| 수락됨

답변 있음
how to add zeros to the beginning and end
Lots of ways to do this. Depends on how many zeros you want. E.g., a = [0 0 a 0 0]; Or, m = 2; n = 2; a = [zeros(1,m) a z...

대략 6년 전 | 0

답변 있음
Keep the negative value while squaring
Change this Velocity(t)^2 to this abs(Velocity(t)) * Velocity(t)

대략 6년 전 | 2

| 수락됨

답변 있음
Satellite orbital parameter problem
Use the orbital geometry to calculate the true anomaly at the ascending node, and then plug that value into the conic equation t...

대략 6년 전 | 1

답변 있음
Creating 100x1 vector in matlab for TDMA Method
A = what you have already constructed d = repmat([2.5;2.0;1.5;1.0],25,1); Then code up your TDMA. https://en.wikipedia.org/wi...

대략 6년 전 | 1

| 수락됨

답변 있음
Reshape a matrix into vector using rows
b = reshape(a.',1,4); MATLAB array memory is column-wise, so in memory the "a" elements are stored 1,3,2,4. The transpose puts...

대략 6년 전 | 1

| 수락됨

답변 있음
Problems activating license MATLAB R2013a or R2013b versions.
This is a user forum. For official TMW help on installation and licensing, contact them directly. Click on the "phone" icon at...

대략 6년 전 | 0

답변 있음
How to convert a sign integer matrix to binary?
Reshaping is fast since it uses a shared data copy instead of a deep data copy. So your three step process isn't going to be sl...

대략 6년 전 | 0

| 수락됨

답변 있음
Array indices must be positive integers or logical values.
These lines: L = charpath(D); Lrand = charpath(Drand); clust = meanC/meanCrand; charpath = L/Lrand; look li...

대략 6년 전 | 0

답변 있음
Matrix dimensions must agree
Yes, you need . in other places. Basically, to do element-wise operations you need to look for all of the x's in your equation ...

대략 6년 전 | 0

답변 있음
Plot x^2+y^2=4
E.g., since you know it is a circle with radius 2 centered at the origin; ang = 0:0.01:2*pi; x = 2*cos(ang); y = 2*sin(ang); ...

대략 6년 전 | 1

답변 있음
Matrix n x n with n is integer
Examples, If N is a 5x7 matrix and n is 3, then your function would return N(1:3,5:7), the 3x3 sub-matrix at the top right cor...

대략 6년 전 | 0

답변 있음
How to solve a second order differential equations with matrices by using "ODE45"?
1/m is a scalar/3x3 hence the error. Normally I would advise backslash here, but that brings up another issue. If M, C, and K ...

대략 6년 전 | 2

답변 있음
Image read in MATLAB and C
An int is likely 4 bytes on your machine, not 2 bytes. Also the expression "order" by itself evaluates as a pointer to the firs...

대략 6년 전 | 0

답변 있음
Appending a row vector into a matrix based on given conditions
x = abs(b-60) > abs(b-550); % fixed typo xzplane550 = equakemat(x,:); xzplane60 = equakemat(~x,:); If all the data ends up in...

대략 6년 전 | 0

| 수락됨

답변 있음
Is it a mistake that the function sum?
Welcome to the world of floating point arithmetic. https://www.mathworks.com/matlabcentral/answers/57444-faq-why-is-0-3-0-2-0-1...

대략 6년 전 | 1

답변 있음
return any angle to (0 to 2pi) range
The short answer: mod(x,2*pi) The long answer for this particular mod operation, is that if you want to get the same answer fo...

대략 6년 전 | 0

| 수락됨

답변 있음
Precision quandaries: why can I print 64 digits?
What you describe sounds like it is just a display issue. Earlier versions of MATLAB on PC machines used a library print functi...

대략 6년 전 | 0

| 수락됨

답변 있음
Grabbing number from array to calculate the numerical derivative
For the version you post, see the diff( ) function along with element-wise divide. E.g., diff(y) ./ diff(x) If that doesn't wo...

대략 6년 전 | 0

| 수락됨

답변 있음
Coding a quadratic root finder
I would advise having your logic figure out what situation you have before you start solving things. E.g., something like if( a...

대략 6년 전 | 0

답변 있음
Numerical solution of ODEs system using ODE45
You've got a 2nd order DE and a 3rd order DE, so the order of your system is 2+3=5, not 6. So your state vector should have 5 e...

대략 6년 전 | 1

| 수락됨

답변 있음
Am I doing this right? (a Math formula to Matlab language)
You are on the right track, but have typos in the code due to parentheses issues. A = sum( (x - y).^2 ); B = sum( (x - mean(x)...

대략 6년 전 | 1

| 수락됨

답변 있음
Numerical solution of Higher order differential equation using ODE45 and a m. archice
t is a number, not a symbol. So u = sin(t) is a number, not a symbolic function. So doing diff(u) does diff on a single value,...

대략 6년 전 | 0

| 수락됨

더 보기