Answered
subtract two identical float number it gives a very small number not a zero
Matlab's double precision numbers are in binary form, and therefore cannot represent the quantity 0.9500 exactly. Using binary ...

11 years ago | 1

Answered
Graph intersection of 3 curves
Use 'roots' on the cubic polynomial difference between y1 and y2 to get the three intersections of the y1 and y2 curves. Simila...

11 years ago | 1

Answered
How can this code run through all possible combinations of numbers in two separate arrays?
Use for-loops: for iA = 1:length(A) a = A(iA); for iB = 1:length(B) b = B(ib); % Use a and b a...

11 years ago | 0

Answered
a problem about integration
Just in case it is of interest to you, here is that infinite series expansion of your integral which I referred to: -2*pi*((...

11 years ago | 1

| accepted

Answered
In a for loop matrix dimension changes?
If 'SWfunction' produces a scalar value, then 'w' will be a scalar, that is 1 x 1, since it is being overwritten 400 times in yo...

11 years ago | 2

| accepted

Answered
How to give ranking from highest to lowest
This should give you the rank you are asking for, Mekala: [~,p] = sort(Data,'descend'); r = 1:length(Data); r(p) =...

11 years ago | 10

| accepted

Answered
how to populate the left side with the same values as the right side in an array
t = 1:floor(n/2); P(:,t) = P(:,n+1-t);

11 years ago | 0

Answered
problems with plotting density function
In terms of the numerical quantities matlab is dealing with, it is not possible to define a probability density for a discrete-v...

11 years ago | 2

| accepted

Answered
Question about for construct?
You shouldn't have to actually activate those 'for-loops' to determine how many times they will execute. You can do it in your ...

11 years ago | 1

| accepted

Answered
How can I plot values of a for loop?
In your for loop you are not placing the successive values of Tc and Q in vectors. Instead they are being overwritten so that o...

11 years ago | 0

| accepted

Answered
matlab triple integral conical gravity
I have a very ancient version of the Symbolic Toolbox, but it has trouble with substituting z for (z^2)^(1/2) if you integrate w...

11 years ago | 0

Answered
Generate Random Numbers such that Sum of their Squares is 1 ???
If you drop any requirement of having a "normal" distribution, you can do this: x = randn(n,1); x = x/sqrt(sum(x.^2));...

11 years ago | 0

Answered
How to get the accurate coordinate value of the point on a fitted contour? And how to integrate along the contour?
You can obtain a two-row matrix, C, from your call to 'contour' which contains x,y coordinates for points along contours: ...

11 years ago | 2

| accepted

Answered
How to calculate the orientation/angle of a 3D gradient.
I did in fact look at equation (1) of the article you referenced, R Bruggink. If that is the computation you are asking about, ...

11 years ago | 3

| accepted

Answered
I need help with this > mx ̈+b(x ) ̇+k(x^3+∝x)=0 with I.c. x(0)=1 and x ̇(0) =0
The following website documents the numerical differential equations solvers. Read it carefully. It can solve your problem. ...

11 years ago | 1

| accepted

Answered
What is missing in this code to solve the problem?
If your image shows the code you tried, then here are some objections I have: 1) The defined function 'fal' needs to be termi...

11 years ago | 1

Answered
Product of two real numbers gives (sometimes!) a complex number?
In your computation you are assuming that multiplication with floating point numbers always obeys the associative law of multipl...

11 years ago | 2

| accepted

Answered
How do I solve solve an equation for the first complex root?
This is a quadratic equation of the form "a*x^2+b*x+c=0" with complex-valued coefficients, b and c. The same formula as for rea...

11 years ago | 1

Answered
How to apply velocity + acceleration to a position?
You can approach this problem two ways. One is symbolic and other is numeric. As you are probably aware, you have two entirely...

11 years ago | 1

Answered
matlab program help looping over t and the indices of a matrix to fill in entries
When you get to the third row where k = 3 and where t has ascended to 1500, the value of sinh(((2*t)-1)*pi*(k-1)/20) i...

11 years ago | 1

Answered
Select everything NOT returned by index
You can always do logical indexing using the negation of whatever condition you have. t = wind(:,:,1)>0&wind(:,:,2)>0; ...

11 years ago | 5

| accepted

Answered
How do I use of "trapz" for numerical integration?
The quantity which you have designated as 'r1' in the call to 'trapz' is meant to represent the variable of integration, and as ...

11 years ago | 1

Answered
How can I permute a 3D magic matrix such that the largest element will be on page 3.
By "permutation" I assume you mean a permutation among the 3D pages. [~,ind] = max(A(:)); [~,~,i3] = ind2sub(size(A),i...

11 years ago | 1

| accepted

Answered
How to solve multiple equations
Consult these two sites carefully: http://www.mathworks.com/help/symbolic/syms.html http://www.mathworks.com/help/symb...

11 years ago | 1

Answered
Triple integral using integral3
The 'integral3' function performs numerical integration for which numerical values must be supplied. The form of your code look...

11 years ago | 1

Answered
How do i setup for this function?
If we call d = Y-X, by plotting d as a function of Kbf it is immediately evident that Kbf attains a minimum when d is zero. (St...

11 years ago | 1

| accepted

Answered
How to select randomly among all positive value in a matrix
If I understand you correctly, do this: f = find([m;m2m]>0); % Find all positive value in either array i1 = f(randi(n...

11 years ago | 0

Answered
??? Indexing cannot yield multiple results. [u s v]=svd(a);
By any chance do you have a variable named 'svd'? If so, you should change its name so as not to be confused with matlab's 'svd...

11 years ago | 1

Answered
how to integrate implicitly in matlab
I presume by "implicitly" you mean, given the value of the integral, you are to find the necessary upper limit of integration (o...

11 years ago | 3

Answered
create a binary sequence that consisting of m zeros and n ones in any order.
Or perhaps you want them in random order: x = zeros(1,m+n); p = randperm(1:m+n,n); x(p) = ones(1,n);

11 years ago | 2

Load more