Answered
random numbers inside a rectangle at an angle
Let (x0,y0) be coordinates of one of the rectangle's corners, and let one of its sides stretching from this corner to another co...

12 years ago | 2

| accepted

Answered
How to plot the following function in 3D ?
In that fifth line you have "sin.*(xgrid-ygrid)" instead of sin(xgrid-ygrid). The compiler can't find an argument for the 'sin'...

12 years ago | 0

Answered
Error using ==> sub2ind at 58 Out of range subscript.
The first value of Y, namely 9, is out of range for a subscript in an 8 x 8 matrix. That is undoubtedly what led to the error m...

12 years ago | 1

| accepted

Answered
Calculate the coordinate of intersection point between a line parallel to Y axis and any other straight line
There is no specific function to do that, but matlab has the next best thing, namely, matrix division. I'll generalize your que...

12 years ago | 1

| accepted

Answered
Eliminating zero's between rising and falling edge
It isn't clear just how many consecutive zeros are required for them not to be changed to ones. Your statement "there are atlea...

12 years ago | 1

| accepted

Answered
Could anyone please explain this matlab code...?
The best way to explain your code is to see it in action. Let f be the following: f = 1 2 3 4 5 6...

12 years ago | 1

| accepted

Answered
doulbe the size of all elements in a matrix
There is no specific function that does this, but you can use 'repmat' to accomplish that: B = A(repmat(1:size(A,1),2,1),re...

12 years ago | 0

Answered
Perform operation on matrix without for loop
[m,n] = size(offset); x = bsxfun(@minus,x,reshape(offset,1,m,n));

12 years ago | 0

| accepted

Answered
Replacing all the elements of one matrix with new values (one to one mapping)
[~,~,Fnew] = unique(F(:)); Fnew = reshape(Fnew,size(F));

12 years ago | 0

| accepted

Answered
Numerical Solver in Matlab
As you have discovered the hard way, if you want efficient computation, it is not wise to use 'solve' for each of 10000 to 10000...

12 years ago | 0

Answered
In an assignment A(I) = B, the number of elements in B and I must be the same.
Based on your description, presumably what you are requested to plot is the value of r along one axis and the corresponding valu...

12 years ago | 2

| accepted

Answered
Build a matrix by comparing two other matrices
[t,loc] = ismember(A(:,1:3),B(:,1:3),'rows'); C = B(loc(t),:);

12 years ago | 0

| accepted

Answered
I have a certain matrix .... How do I know the transformation matrix multiplied by ... if the output is also given as a matrix
*"Then the solution is"* should read: "then one of infinitely many solutions is." What you have here are twelve equations and si...

12 years ago | 0

Answered
How to change double sum to be computed in manageable time?
Your addition is in the wrong order, Peter. If you do the summation with respect to j first, you can take advantage of a formul...

12 years ago | 1

Answered
Phase greater than 180 degree
If your phase values are always considered to lie in the interval from 0 to 2*pi, then just apply the 'mod' function: correc...

12 years ago | 0

| accepted

Answered
How can I convert A matrix to B matrix below?
Try this: B = repmat(diag(A),size(A,2)); B = triu(B)+tril(B.',-1);

12 years ago | 1

Answered
Create two vectors X and Y of values from (-pi) to pi with a spacing of pi/10. Define the vector Z as: Z = (sin(sqrt(x^2+y^2)))/(sqrt(x^2+y^2))
You need to put a "dot" in your division operator: Z = (sin(sqrt(x.^2+y.^2)))./(sqrt(x.^2+y.^2)) What you had there with...

12 years ago | 1

| accepted

Answered
Tips to improve calculation speed?
As an example of how you can increase efficiency, in your computation of 'prob' each time you compute this you have to find fact...

12 years ago | 1

| accepted

Answered
Create function multiple variables with using constant in matrix?
Indeed you can use 'fminsearch' to minimize 'f'. However, since we have linearity with respect to the x(1) and x(3) parameters,...

12 years ago | 0

Answered
Hello guys , please help me !
Another hint. The quantity S of the infinite sum is the value of exp(x) when x = 1, assuming k starts at k = 0, so the 'e' you ...

12 years ago | 0

Answered
how can i change the for loop in this program..?
In place of your for-loop you can have: d = 20*[1:10].'; or d = linspace(20,200,10);

12 years ago | 0

| accepted

Answered
explicit integral could not be found
In the integrand, do you mean (x^1.7653)* ((1-x)^3.0546-1) (Case 1) or do you mean (x^1.7653)* (1-x)^(3.0546...

12 years ago | 2

Answered
Calcualting the tension in a wire
The "staircase" effect you are getting is due to the fact that your minimum always occurs at the far end where d = 1, since the ...

12 years ago | 1

Answered
Double integral where one limit can only be solved numerically
The following is approximately what I think you need to do. It may need some adjusting here and there. I am unable to test it ...

12 years ago | 0

| accepted

Answered
Double integral where one limit can only be solved numerically
It's good that you corrected that error replacing V with x. That's an important distinction in the integration process. Howeve...

12 years ago | 0

Answered
how to save each loop data in consecutive rows?
b = zeros(3,2*3); for k = 1:3 a = rand(3,2); b(k,:) = reshape(a.',1,[]); end Note: Your output is 3 by 6, not 3 ...

12 years ago | 0

| accepted

Answered
Simple growth of bacteria question
Knowing how to do it in matlab is only a small part of solving this problem. You should first follow the given hint - the numbe...

12 years ago | 1

Answered
how to convert in matlab?
A = reshape(A.',1,[]);

12 years ago | 1

| accepted

Answered
Extracting elements from matrix to do summation
Matlab can indeed save you some writing. Let these arrays already be defined: c = [c11,c12,...,c1n; c21,c22,...,c2n;...

12 years ago | 0

Load more