Answered
How to reshape and repeat at the same time.
newdata = reshape(repmat(reshape(data,2,[]),2,1),2,[]);

9 years ago | 0

Answered
How to find the intersection of two curves
You can use a modified version of the Newton-Raphson method for finding the intersection of two parameterized curves, provided t...

9 years ago | 0

Answered
How to find the intersection of two curves
You can convert this into the equations of two slanted ellipses. The first ellipse is: (x-y)^2+(2*x+y)^2 = 5*x^2+2*x*y+2*y...

9 years ago | 0

Answered
Trying to Find the solution of trigonometric equation
Rather than using ‘solve’, you should try ‘fzero’ with various different estimated values for y obtained from doing a plot. Thi...

9 years ago | 1

| accepted

Answered
Attempted to access E(3,1); index must be a positive integer or logical. But the index is (3,1) those numbers are both positive. What is going on?
E(t*5,i) has indices that are not always precisely positive integers, because t cannot be precisely equal to all multiples of 0....

9 years ago | 0

| accepted

Answered
Can anyone help me in optimizing (maximizing) the function of two variables?
You don’t need matlab to find the maximum value of this function. The subtraction by 398 does not affect maximization, nor does...

9 years ago | 2

| accepted

Answered
How to find time of flight
It is possibly easier to think of this problem as having the air stand still and both the transmitter and the receiver moving in...

9 years ago | 2

Answered
i have a problem ,
If the derivatives of f with respect to x, to y, and to z are always zero, that means f must be a constant. Whatever the initia...

9 years ago | 0

Answered
Modify array zeros detect
You could also use the following method. A is a row vector with 1’s and 0’s, and m is the least number of successive 0’s before...

9 years ago | 0

Answered
Why does this plot not work? Thank's for every help!
It would be better to first solve the equation for y symbolically and then produce a vector of y values: x = linspace(0.5,8...

9 years ago | 0

Answered
Getting decrease in a sine wave as a function of time
The data you show should probably be fitted with something like: a*exp(-b*time)*sin(c*time+d) with the four parameters, ...

9 years ago | 1

Answered
Distances along a plotted line?
The approximate arclength along your curve from (x(i1),y(i1)) to (x(i2),y(i2)) can be computed as the sum of the line segment le...

9 years ago | 0

Answered
How can I choose specific rows in a matrix? (from 1 to 6 than skip 7 to 16 and start taking again from 17th to 22nd)
X = 1:43008; Y = reshape(X,16,[]); Z = Y; Y = Y(1:6,:); Y = Y(:).’; Z = Z(7:16,:); Z = Z(:).’;

9 years ago | 0

| accepted

Answered
How can I make these separate for loops into a nested for loop together?
You don’t need for-loops at all. k = zeros(size(A)); k(1:5,6:11) = A(3:7,1:6);

9 years ago | 0

Answered
I want a matrix to be represented in the form of an array
Here are the “Pixel Scan” and “Rearrange” operations: % Let M be the m by n image matrix % Pixel Scan: M = M.'; M(...

9 years ago | 0

| accepted

Answered
Split a vector into two vectors randomly
Why not do this: t = original_vec(randperm(Total_Samples)); First_vec = t(1:25); Second_vec = t(26:36);

9 years ago | 1

| accepted

Answered
How to plot a piecewise function?
If you only want to plot the function, do this: x1 = linspace(-5,0,50); y1 = 10*ones(1,50); x2 = linspace(0,9,90); y2 =...

9 years ago | 0

Answered
How I can use perms_reps(vec,reps) function with big vectors
For your particular problem, try this: C = nchoosek(1:45,5); n = size(C,1); M = zeros(n,45); % If you get this far...

9 years ago | 0

| accepted

Answered
Finding real roots of a cubic equation
This is an equation that can be manipulated so that d is one of the roots of a ninth degree polynomial equation of which only on...

9 years ago | 1

Answered
Array that contains a geometric series
A general form for a geometric series is: [a,a*r,a*r^2,a*r^3,...] You can generate n of these by: s = a*r.^(0:n-1);...

9 years ago | 2

| accepted

Answered
Using conditional IF statement
if all(sum(B,2)==1)

9 years ago | 0

| accepted

Answered
i need to reshape rows that are in complicated manner!
The number of rows in A must be even. n = size(A,2); B = reshape(A.’,2*n,[]); B = B(ceil((1:2*n)/2)+n*mod(0:2*n-1,2)...

9 years ago | 1

| accepted

Answered
Count number of consecutive 1's within a block
Let x be the given row vector. f = find(diff([0,x,0]==1)); p = f(1:2:end-1); % Start indices y = f(2:2:end)-p; %...

9 years ago | 10

| accepted

Answered
Non-Sorted nx1 unique values
Let x be the given n by 1 vector. [y,p] = sort(x); d = diff(y)~=0; b = [d;true] & [true;d]; b(p) = b; Then b wi...

9 years ago | 2

| accepted

Answered
i want vector which is long size and each time size change but pattren is same in putting value
Let your resulting matrix, M, have m rows and n columns. b = mod(0:n-1,2)==0; M = repmat((1:n).*b+(-1:n-2).*(~b),m,1);...

9 years ago | 0

Answered
How to avoid using 'For loops' while I need to do some operations on the columns of a matrix?
I assume that mu is 1 by d, Sigma is d by d, w is 1 by d, and y is k by 1 where d is the number of elements in the multivariate ...

9 years ago | 0

| accepted

Answered
How can I have a warning issued when matlab "rounds" a large number to Inf?
Matlab overflows to infinity (or minus infinity) whenever the result of an operation would round an answer beyond the largest nu...

9 years ago | 1

Answered
lognrnd Function does not work properly at high variance
If you look at the probability density function that corresponds to your particular mu and sigma combination, you will see that ...

9 years ago | 0

Load more