Answered

Masking out Image area using Binary Mask

Let I be the m-by-n image, and let M be the m-by-n mask. The new image, Inew, will be m-by-n and have zeros everywhere there ...

Masking out Image area using Binary Mask

Let I be the m-by-n image, and let M be the m-by-n mask. The new image, Inew, will be m-by-n and have zeros everywhere there ...

mer än 10 år ago | 13

| accepted

Answered

Surf z axis not visible

After issuing peaks issue the command zlabel('z')

Surf z axis not visible

After issuing peaks issue the command zlabel('z')

mer än 10 år ago | 1

Answered

RESAMPLING DATA

One way: numData = xlsread('yourExcelFile.xlsx'); % read in data numDataOut = numData(1:15:end); % subsample (get every ...

RESAMPLING DATA

One way: numData = xlsread('yourExcelFile.xlsx'); % read in data numDataOut = numData(1:15:end); % subsample (get every ...

mer än 10 år ago | 0

| accepted

Answered

compute the unit vector given the angle

Given the angle theta in radians (counter-clockwise is positive theta, theta = 0 points in the positive x-direction) you...

compute the unit vector given the angle

Given the angle theta in radians (counter-clockwise is positive theta, theta = 0 points in the positive x-direction) you...

mer än 10 år ago | 0

Answered

I am writing code for a function but I get an error message

Just replace && with & and double pipes | | with | to operate on nonscalars.

I am writing code for a function but I get an error message

Just replace && with & and double pipes | | with | to operate on nonscalars.

mer än 10 år ago | 2

| accepted

Answered

merge number and character

If x = 3; y = '-'; merge with [num2str(x),y]

merge number and character

If x = 3; y = '-'; merge with [num2str(x),y]

mer än 10 år ago | 1

Answered

dividing a matrix into equal submatrices

I assume that your vector, x, is n-by-1 where n is divisible by 10. Try xIntoTenPieces = reshape(x,[],10); which p...

dividing a matrix into equal submatrices

I assume that your vector, x, is n-by-1 where n is divisible by 10. Try xIntoTenPieces = reshape(x,[],10); which p...

mer än 10 år ago | 0

| accepted

Answered

Problem with the mean function

Try this meanWithoutNans = mean(refoulement(~isnan(refoulement)));

Problem with the mean function

Try this meanWithoutNans = mean(refoulement(~isnan(refoulement)));

mer än 10 år ago | 0

| accepted

Answered

Count number of specific values in matrix

Try this: numberOfNonZeros = nnz(m==4); Using nnz is more efficient than converting logicals to numeric, which is requir...

Count number of specific values in matrix

Try this: numberOfNonZeros = nnz(m==4); Using nnz is more efficient than converting logicals to numeric, which is requir...

mer än 10 år ago | 18

Answered

Operate on Successive Values Without Loops

Totally... first arrange your vectors as column vectors, then try distance = sum(sqrt((x(1:end-1)-x(2:end)).^2 + (y(1:end-1...

Operate on Successive Values Without Loops

Totally... first arrange your vectors as column vectors, then try distance = sum(sqrt((x(1:end-1)-x(2:end)).^2 + (y(1:end-1...

mer än 10 år ago | 0

| accepted

Answered

Attempt to have a 3D mesh plot of max value of real part of eigenvalues of a matrix. Shows error saying that 'Error showing Horzcat. CAT arguments dimensions are not consistent' even though my matrix is square.

When you create BKm, you use the output k from meshgrid. The output k is a 1001 square matrix that you are effectively trying t...

Attempt to have a 3D mesh plot of max value of real part of eigenvalues of a matrix. Shows error saying that 'Error showing Horzcat. CAT arguments dimensions are not consistent' even though my matrix is square.

When you create BKm, you use the output k from meshgrid. The output k is a 1001 square matrix that you are effectively trying t...

mer än 10 år ago | 0

Answered

still not getting the oop concept... please help

You can get the behavior you want if you subclass the handle class. To do this, 1.) replace the line classdef manlists ...

still not getting the oop concept... please help

You can get the behavior you want if you subclass the handle class. To do this, 1.) replace the line classdef manlists ...

mer än 10 år ago | 1

Answered

matlab trick

I'm assuming the images all have the same extension and that the file format is supported by imread. Also, I'm assuming that th...

matlab trick

I'm assuming the images all have the same extension and that the file format is supported by imread. Also, I'm assuming that th...

mer än 10 år ago | 0

Answered

Integral of sin(cos(x))

Ultimately, are you trying to compute a definite integral? If there are limits, you may be able to use Bessel functions to eval...

Integral of sin(cos(x))

Ultimately, are you trying to compute a definite integral? If there are limits, you may be able to use Bessel functions to eval...

mer än 10 år ago | 0

| accepted

Answered

how to click a point in an image

Check out the function ginput doc ginput

how to click a point in an image

Check out the function ginput doc ginput

mer än 10 år ago | 0

Answered

equality operator between matrix and scalar

The value .1 and a(12) differ by only one bit as a result of numerical round-off. You can see this with the commands num2h...

equality operator between matrix and scalar

The value .1 and a(12) differ by only one bit as a result of numerical round-off. You can see this with the commands num2h...

mer än 10 år ago | 1

Answered

Assigning time points on X axis

If your sampling frequency is 44.1 kHz, then one millisecond comprises 44.1 time samples. So, if x represents the vector of 18,...

Assigning time points on X axis

If your sampling frequency is 44.1 kHz, then one millisecond comprises 44.1 time samples. So, if x represents the vector of 18,...

mer än 10 år ago | 0

| accepted

Answered

Sorting NaN

This will work newA = a; % copy original matrix isANanRow = any(isnan(a),2); % find rows that have a nan in them % mo...

Sorting NaN

This will work newA = a; % copy original matrix isANanRow = any(isnan(a),2); % find rows that have a nan in them % mo...

mer än 10 år ago | 0

Answered

Transforming uniform variables to normal variables

You know that the histogram shouldn't exactly match a Gaussian... Nevertheless, if you use the command above, you are guaranteed...

Transforming uniform variables to normal variables

You know that the histogram shouldn't exactly match a Gaussian... Nevertheless, if you use the command above, you are guaranteed...

mer än 10 år ago | 0

Answered

Transforming uniform variables to normal variables

I will assume that your uniform random variables are stored in an array just like the one created with the commands X = ran...

Transforming uniform variables to normal variables

I will assume that your uniform random variables are stored in an array just like the one created with the commands X = ran...

mer än 10 år ago | 0

| accepted

Answered

Using a variable in a matrix then plotting one element of the matrix.

When matlab sees A.*B or A.^B the two arrays A and B need to be the same size. In the expression Z = -M.*Om.^2 + i.*Om.*C + K, ...

Using a variable in a matrix then plotting one element of the matrix.

When matlab sees A.*B or A.^B the two arrays A and B need to be the same size. In the expression Z = -M.*Om.^2 + i.*Om.*C + K, ...

mer än 10 år ago | 0

| accepted

Answered

Recursive relation

First, if y depends on the variable x, it would help if you renamed the coefficients in the power series expansion for y from x_...

Recursive relation

First, if y depends on the variable x, it would help if you renamed the coefficients in the power series expansion for y from x_...

mer än 10 år ago | 0

Answered

Recursive relation

If I assume a power series solution of the form y(x) = \sum_{k = 0}^\infty\alpha_kx^x, I arrive at the recursion (n+1)\...

Recursive relation

If I assume a power series solution of the form y(x) = \sum_{k = 0}^\infty\alpha_kx^x, I arrive at the recursion (n+1)\...

mer än 10 år ago | 0

Answered

How to reshape a cell array of cell arrays

I assume your 1-by-10 cell is just like the 1-by-10 cell C created with the commands C = cell(1,10); for i = 1:10 ...

How to reshape a cell array of cell arrays

I assume your 1-by-10 cell is just like the 1-by-10 cell C created with the commands C = cell(1,10); for i = 1:10 ...

mer än 10 år ago | 6

| accepted

Answered

Quickly converting country names to numbers

I assume your table is a n-by-2 cell array, where the first column contains cells whose contents are the names of each country a...

Quickly converting country names to numbers

I assume your table is a n-by-2 cell array, where the first column contains cells whose contents are the names of each country a...

mer än 10 år ago | 1

| accepted

Answered

MATLAB Matrice Function Question help please?

It's a toeplitz matrix... so use the command toeplitz(0:4) to recreate your example. I'm sure you can extrapolate to t...

MATLAB Matrice Function Question help please?

It's a toeplitz matrix... so use the command toeplitz(0:4) to recreate your example. I'm sure you can extrapolate to t...

mer än 10 år ago | 2

| accepted

Answered

vectorizing nested loops

Sorry, but I don't have a suggestion to vectorize this thing. However, as the following code demonstrates, it looks like you co...

vectorizing nested loops

Sorry, but I don't have a suggestion to vectorize this thing. However, as the following code demonstrates, it looks like you co...

mer än 10 år ago | 1

Answered

xlswrite dropping strings

It's hard to tell without more detail on the contents of result.xls_full_data. However, if your strings are nested in a cell in...

xlswrite dropping strings

It's hard to tell without more detail on the contents of result.xls_full_data. However, if your strings are nested in a cell in...

mer än 10 år ago | 1

Answered

Need to make a 4D plot (3D + Colour)

I take it that the four dimensions are the four different indices you are using to index your signals? If so, why would you trea...

Need to make a 4D plot (3D + Colour)

I take it that the four dimensions are the four different indices you are using to index your signals? If so, why would you trea...

mer än 10 år ago | 0

Answered

MATLAB OOP - calling an object method from within another object method

One way is via composition: (see <http://en.wikipedia.org/wiki/Object_composition>) Let your two classes be class A and class...

MATLAB OOP - calling an object method from within another object method

One way is via composition: (see <http://en.wikipedia.org/wiki/Object_composition>) Let your two classes be class A and class...

mer än 10 år ago | 0

| accepted