Answered
Function in Matlab
I'm not exact sure what you are asking, so perhaps you can clarify. You can declare a variable to be global >> global ...

14 years ago | 0

Answered
avoiding for loop
A=[1 2 3 4 5]'; B=[4 5 6 2 1]'; C = [A B]; D = C(:,2)-C(:,1); out = [sum(C(D>0,:),2); diff(C(D<=0,:),[],2)]

14 years ago | 0

Answered
creation of exe file
See the help for mcc and mccinstaller and deploytool The documentation walks you through a simple example: <http://www.mat...

14 years ago | 0

Answered
How to implement nise of specific bandwidth?
Take a broadband noise and the use a bandpass filter. Keep in the mind that the noise samples will be autocorrelated after you u...

14 years ago | 0

| accepted

Answered
How to round the decimals?
One way here is: X = 0.135678; format bank; X Another way is: format; %just returning the formatting ...

14 years ago | 0

Answered
Append/Alter string in Title
plot(randn(100,1)); h = title('Test'); origtitle = get(h,'String'); set(h,'String',[origtitle ' 2'])

14 years ago | 1

| accepted

Answered
imfilter
Zhang, the difference is that there is a rotation of the kernel by 180 degrees (pi radians) between the two. So for: h...

14 years ago | 0

| accepted

Answered
imfilter and filter2
Yes, they are the same in some instances: h = 1/100*ones(10,10); x = randn(20,20); y = filter2(h,x); y1 = ...

14 years ago | 0

| accepted

Answered
How to use Semilogy in MATLAB
Why are you using semilogy in a for loop where you are only plotting a single value for A at a time? Save the values of A in ...

14 years ago | 0

Answered
Sin Cos calculation for a regression
The (2*pi) is just because you are converting the frequencies from cycles\day into radians\day. When you then multiply that by d...

14 years ago | 0

| accepted

Answered
3D image
What format is it? You can use imread() for a number of formats. If it is just stored in a .mat file, then use load()

14 years ago | 0

Answered
Regression Fit a SinWave to a dataset?
You are not using what I gave you. You are using %betahat = X/y; Look at the example I gave you: y = score(:); %make...

14 years ago | 0

Answered
Regression Fit a SinWave to a dataset?
Because when you do a spectral analysis, the frequency spacing in your case is 1/501. So you only get frequency estimates at 0, ...

14 years ago | 0

Answered
Regression Fit a SinWave to a dataset?
Something is probably off in your spectral analysis in identifying the frequency. You have 501 points, which means the spacing b...

14 years ago | 0

| accepted

Answered
Turning array values into values on an x axis
x = ones(500,1); indices = [2 3 6 9]; x(indices) = 2; Or x = ones(500,1); x(indices) = x(indices)+1;

14 years ago | 1

| accepted

Answered
How do i create a matrix of size 1 row and 1501 column, with values [1 -1 1 -1 1 -1.... etc
One way: x = ones(1,1501); x(2:2:end) = -1*x(2:2:end); Another way y = repmat([1 -1],1,751); y(end) = [];

14 years ago | 1

Answered
Calculate the frequency range and plot the unwrapped phase spectrum
Honglei makes two good points in his comments. I'll assume you are talking about the distribution of the squared-magnitudes ...

14 years ago | 0

| accepted

Answered
kmeans
You do the same thing except: plot(X(idx==1,1),X(idx==1,2),'r.','MarkerSize',10); hold on plot(X(idx==2,1),X(id...

14 years ago | 0

| accepted

Answered
How do I Regression Fit a SinWave to a dataset?
You need to know what periods you want to fit. You had another post where you talked about fitting city population for a period ...

14 years ago | 4

| accepted

Answered
what the right function ?
It looks to me like this function is ok. I mean you don't need the semicolons after the ends, but ok fine. Did you save this...

14 years ago | 0

Answered
Small Problem with 'if' statement and array index
This is a matrix as the first element of a cell array? If so (and if by line you mean row), then you want to address that by ...

14 years ago | 0

Answered
Writing data into an array
Can you be more specific what you mean by store? Images in MATLAB are naturally matrices, either 2-D matrices, or 3-D for someth...

14 years ago | 0

Answered
Autocorrelation function of sin(ωt) -- XCORR complications
To address your first question, the x-axis does not go up to 2000 seconds. What you have to keep in mind is that the autocorrela...

14 years ago | 0

Answered
sub2ind error
Your x and y vectors are not suitable for sub2ind(). You have an x vector that starts at 0 which is not a valid linear index in ...

14 years ago | 1

Answered
Fundamental Frequency
Yes,collect the F0 estimates in a vector and create a vector of times of equal length. Then just, plot(t,F0) However, y...

14 years ago | 0

Answered
How to use "zeros" to replace for loop?
frame1 = zeros(303,381,3);

14 years ago | 0

Answered
remove index
x = [10 2 3 5 15 7 8 100 2 10 12 23 20]; x(3:3:end) = [];

14 years ago | 0

| accepted

Answered
Eigenvectors of a nonsymmetric matrix.
Below W are the left eigenvectors, use the one associate with the largest eigenvalue. If A is your matrix [W,D] = eig(A...

14 years ago | 0

| accepted

Answered
Error- Subscript indices must either be real positive integers or logicals.
A couple things: 1.) Is this an RGB image? The 3-D wavelet transform is not suitable for an RGB image. The 3-D wavelet transf...

14 years ago | 0

| accepted

Answered
plot grid
Are you sure you want to do that? You won't be able to see the xticklabels even if you make the font really small. Here is an...

14 years ago | 0

| accepted

Load more