Answered

c0 and x are scalars, c - vector, and p - scalar. If c is [ ], then p = c0. If c is a scalar, then p = c0 + c*x . Else, p =

function y = mypolyval(c0,c,x) if isempty(c) y = c0; else y = c0 + power(x, 1:numel(c))*c(:); end Th...

c0 and x are scalars, c - vector, and p - scalar. If c is [ ], then p = c0. If c is a scalar, then p = c0 + c*x . Else, p =

function y = mypolyval(c0,c,x) if isempty(c) y = c0; else y = c0 + power(x, 1:numel(c))*c(:); end Th...

6 years ago | 1

| accepted

Answered

How to remove duplicates in a specific manner?

B = unique(unique(A, 'rows')', 'rows')'

How to remove duplicates in a specific manner?

B = unique(unique(A, 'rows')', 'rows')'

6 years ago | 0

Answered

if i want to plot a graph as i have shown in the figure, but at one particular angle without any radius...how should i do it ? l

axis([-1 1 -1 1]), axis equal angle = 30; line([0 cosd(angle)], [0, sind(angle)])

if i want to plot a graph as i have shown in the figure, but at one particular angle without any radius...how should i do it ? l

axis([-1 1 -1 1]), axis equal angle = 30; line([0 cosd(angle)], [0, sind(angle)])

6 years ago | 0

Answered

how to write this for cycle

You have to use a cell array because your indices have different sizes e = 6:12; for i = 1:numel(e), x{2^e(i)} = 0:1/2^e...

how to write this for cycle

You have to use a cell array because your indices have different sizes e = 6:12; for i = 1:numel(e), x{2^e(i)} = 0:1/2^e...

6 years ago | 0

Answered

Check for existence of nested fields

You can use my function isnestedfield: function yn = isnestedfield(s, fields) %ISNESTEDFIELD True if nested fields are i...

Check for existence of nested fields

You can use my function isnestedfield: function yn = isnestedfield(s, fields) %ISNESTEDFIELD True if nested fields are i...

6 years ago | 2

| accepted

Answered

How can i create a large colum variable with continious step?

You don't need a loop, you can use Matlab's colon operator to define a range of values first_value:step_size:last_value. You can...

How can i create a large colum variable with continious step?

You don't need a loop, you can use Matlab's colon operator to define a range of values first_value:step_size:last_value. You can...

6 years ago | 1

Answered

Searching for math expert! angle of vectors in a loop using law of cosines

See also <http://www.wikihow.com/Find-the-Angle-Between-Two-Vectors> % define sample values x = [1234.77 936.40 681.39...

Searching for math expert! angle of vectors in a loop using law of cosines

See also <http://www.wikihow.com/Find-the-Angle-Between-Two-Vectors> % define sample values x = [1234.77 936.40 681.39...

6 years ago | 1

| accepted

Answered

Extract values from matrix/cell in single step

Have a look at <https://de.mathworks.com/matlabcentral/answers/121045-assigning-multiple-outputs-from-a-vector> and <https...

Extract values from matrix/cell in single step

Have a look at <https://de.mathworks.com/matlabcentral/answers/121045-assigning-multiple-outputs-from-a-vector> and <https...

6 years ago | 1

Answered

how delete all the negative values

x = x(find(x < 0, 1, 'last'):end);

how delete all the negative values

x = x(find(x < 0, 1, 'last'):end);

6 years ago | 0

| accepted

Answered

How to find even positioned numbers in a vector or matrix.

if size(M,1) > 1 & size(M,2) > 1 res = M(2,2); else res = []; end

How to find even positioned numbers in a vector or matrix.

if size(M,1) > 1 & size(M,2) > 1 res = M(2,2); else res = []; end

6 years ago | 0

| accepted

Answered

How to plot x=f(y) ?

Instead of plot(x,y), you plot(y,x) x = linspace(-3,3); plot(x.^3+x.^2-x+6, x), xlabel('y'), ylabel('x')

How to plot x=f(y) ?

Instead of plot(x,y), you plot(y,x) x = linspace(-3,3); plot(x.^3+x.^2-x+6, x), xlabel('y'), ylabel('x')

6 years ago | 0

Answered

Generating an "all-combinations" matrix for a given vector

x = [2 3 4]; n = prod(x); for i = 1:numel(x) li = []; for ii = 1:x(i), li = [li repmat(ii, [1 n/prod(x(1:i))])]; en...

Generating an "all-combinations" matrix for a given vector

x = [2 3 4]; n = prod(x); for i = 1:numel(x) li = []; for ii = 1:x(i), li = [li repmat(ii, [1 n/prod(x(1:i))])]; en...

6 years ago | 0

| accepted

Answered

what is meant by index exceed matrics dimension?

If you have a 1 x 3 matrix A = [6 7 9] and try to access an element that does not exist, like A(2,3) or A(1, 4), you get ...

what is meant by index exceed matrics dimension?

If you have a 1 x 3 matrix A = [6 7 9] and try to access an element that does not exist, like A(2,3) or A(1, 4), you get ...

6 years ago | 0

Answered

Plotting points across the Sine Curve

plot(t, y) hold on ind = find(diff(y>0)<0); plot(t(ind), y(ind), 'ko') ind = find(diff(y>0)>0); plot(t(ind)...

Plotting points across the Sine Curve

plot(t, y) hold on ind = find(diff(y>0)<0); plot(t(ind), y(ind), 'ko') ind = find(diff(y>0)>0); plot(t(ind)...

6 years ago | 0

| accepted

Answered

How would I check to see if the number of rows in one matrix are equal to the number of rows in another matrix?

You can use assert assert(size(A,1) == size(B, 1), 'Matrices have different numbers of rows.') If the condition given as...

How would I check to see if the number of rows in one matrix are equal to the number of rows in another matrix?

You can use assert assert(size(A,1) == size(B, 1), 'Matrices have different numbers of rows.') If the condition given as...

6 years ago | 0

Answered

Detail lost showing images

900 x 1800 is pretty large. You can check the screen size using get(0,'ScreenSize') If your image fits on the screen...

Detail lost showing images

900 x 1800 is pretty large. You can check the screen size using get(0,'ScreenSize') If your image fits on the screen...

6 years ago | 0

| accepted

Answered

I understand the point of asking a question is to not automatically be given the answer. However I have no clue how to even approach the given questions that are mentioned below. I looked up a way to do it on the Matlab website already but am lost.

function g = grade(num) if num < 60 g = 'E' elseif num < 70 g = 'D' and so on.

I understand the point of asking a question is to not automatically be given the answer. However I have no clue how to even approach the given questions that are mentioned below. I looked up a way to do it on the Matlab website already but am lost.

function g = grade(num) if num < 60 g = 'E' elseif num < 70 g = 'D' and so on.

6 years ago | 0

Answered

What font can I use to match my text to greek letters?

In which way are Matlab's default fonts for Greek and other characters not matching? You can change various properties, such...

What font can I use to match my text to greek letters?

In which way are Matlab's default fonts for Greek and other characters not matching? You can change various properties, such...

6 years ago | 0

Answered

Ignore answers with imaginarey components

This is basically the implementation of Dr. Siva Srinivas Kolukula's answer: ind = ~isreal(C); A(ind) = []; B(ind) = [];...

Ignore answers with imaginarey components

This is basically the implementation of Dr. Siva Srinivas Kolukula's answer: ind = ~isreal(C); A(ind) = []; B(ind) = [];...

6 years ago | 0

Answered

How to polarplot theta=3*pi/4 ?

theta = 3/4*pi; plot([0 cos(theta)], [0 sin(theta)]) axis equal axis([-1 1 -1 1])

How to polarplot theta=3*pi/4 ?

theta = 3/4*pi; plot([0 cos(theta)], [0 sin(theta)]) axis equal axis([-1 1 -1 1])

6 years ago | 0

Answered

converting matrix into image

I = im2double(imread('circuit.tif')); imshow(I)

converting matrix into image

I = im2double(imread('circuit.tif')); imshow(I)

6 years ago | 1

Answered

how to run a certain code loop for 'N' times and get 'N' number of output outside the loop.

You don't need the loop: A = rand(3, 5, N);

how to run a certain code loop for 'N' times and get 'N' number of output outside the loop.

You don't need the loop: A = rand(3, 5, N);

6 years ago | 1

Answered

How can I keep figures invisible when going between different figures and different subplots?

Don't use figure(2) but set(0, 'CurrentFigure', f(2)) where f(2) is the handle of figure 2, obtained with gcf wh...

How can I keep figures invisible when going between different figures and different subplots?

Don't use figure(2) but set(0, 'CurrentFigure', f(2)) where f(2) is the handle of figure 2, obtained with gcf wh...

6 years ago | 0

| accepted

Answered

How to change gap between legend line and legend text?

You can increase the space by adding blanks ' ' in front of the legend entries. This is a hack, of course.

How to change gap between legend line and legend text?

You can increase the space by adding blanks ' ' in front of the legend entries. This is a hack, of course.

6 years ago | 0

| accepted

Answered

How to draw nice dotted lines?

Check out <https://de.mathworks.com/matlabcentral/fileexchange/15743-fix-dashed-and-dotted-lines-in-eps-export>

How to draw nice dotted lines?

Check out <https://de.mathworks.com/matlabcentral/fileexchange/15743-fix-dashed-and-dotted-lines-in-eps-export>

6 years ago | 1

Answered

How can I plot an average line through this line graph

You store the values of each line in the rows of matrix X. Then use plot(mean(X))

How can I plot an average line through this line graph

You store the values of each line in the rows of matrix X. Then use plot(mean(X))

6 years ago | 2

Answered

I need to take characters out of a string using isnan and str2double.

cellfun(@(x) sscanf(x, '%f'), regexp(a, '(\d+)', 'match'))

I need to take characters out of a string using isnan and str2double.

cellfun(@(x) sscanf(x, '%f'), regexp(a, '(\d+)', 'match'))

6 years ago | 0

| accepted