This question already has answers here:
How to make a Simple FIR Filter using Matlab?
(3 answers)
Closed 8 years ago.
I have this homework where I have a signal, actually a sum of signals and it is requested to make a FIR filter of it which will cut frequencies above 40 Hz and will have width N=41 and for its construction use a squared window.How I am supposed to do that ,I have trouble finding the commands,then it says to print with semilogy the transfer function and the impulse response of the filter.Please help me by providing me the necessary commands and the methodology.Thanks in advance.
Do you have the Signal Processing Toolbox?
use the fdatool to find out what you actually want.
Decide which filter you want to use and have a look into the matlab
documentation of that filter, it will provide you the code you need
you will get a transfer function structure tf
you can plot the tf-system with bode(sys) and you get the frequency response
If you don't have the toolbox you have to design the filter by hand, determine the transfer function and use tf( numerator-vector, denumerator-vector ) to define it.
Related
I'm trying to make a low pass filter using MatLab to filter a matrix of data points I've imported.
My question is, although I'm already able to filter a made up noise by filter functions, I don't know how to filter a matrix of data points. the noisy signal and filtered signal, as I expect, can be seen in the upper figure and lower figure respectively.
please help me out.
Thanks.
This question already has answers here:
How can I extrapolate to higher values in Matlab? [closed]
(2 answers)
Closed 7 years ago.
Currently I have a 1d vector, which when plotted, gives the blue line in the plot below. Now I want to extend this line based on the data values of vector I already have (as shown by the red line). I am aware that I can use simple machine learning to this problem. But is there an inbuilt MATLAB library functon which can also achieve this?
What exactly would you call this problem of extending the data? It's not interpolation, and I'm sure extrapolation is not a concept. Do not hesitate to ask any questions that would clarify this problem.
Extrapolation is what you're looking for. Since the final part of the curve you want to estimate is rather linear you can use the linear extrapolation.
Let's say our function is f(i)=i for i=1,...,50, with some random noise added.
signal=(1:50)+rand(1,50);
The original signal looks like
Now let's say we want to estimate the following 10 samples, that is for i=51,...,60. By means of linear extrapolation, we can append these 10 samples by the following loop:
for i=51:60
signal(i)=signal(i-2)+((i-(i-2))/((i-1)-(i-2)))*(signal(i-1)-signal(i-2));
end
The original formula has been taken from here, in which x_star=i, x_{k-1}=i-2, x_{k}=i-1, y(x_star) is the value we're estimating, y_{k-1}=signal(i-2), y_{k}=signal(i-1). Obviously you should re-adapt such formula with the function you're using. Basically you're using the previous 2 values to evaluate the new value.
Now that these newly estimated 10 samples have been appended, signal has the form
This question already has answers here:
Test if a data distribution follows a Gaussian distribution in MATLAB
(3 answers)
Closed 8 years ago.
I have a data set that i want find which distribution is fit to it. How can I check difference distributions on this database? Is any code or automatic code for do that in MATLAB?
Thanks.
I think what you're looking for is called the Bayesian Information Criterion or BIC. Check it out on Wikipedia... Then pick several distributions, calculate the BIC for each distribution with your data, and finally see which one has the best BIC.
Although I make this out to be a simple problem, it actually isn't. For many distributions calculating the BIC requires numerical optimization over the parameters of the distribution. However for some distributions Matlab can calculate the Maximum Likelihood Estimator (MLE) for you automatically, which is part of what you'll need for the BIC.
I have a Laplace Transfer function that I wish to use in a high pass filter. I am trying to design a filter inside Matlab that will use this function using FDAtool but I don't understand how the parameters and coefficients this tool uses relates to the Laplace function I have.
Can anyone provide some information or links regarding the relationship between a function and the filter that uses it.
Why don't you simply use a Transfer Fcn block (or a Discrete Transfer Fcn block if it's discrete) since you already have the Laplace transfer function? FDAtool is for designing a filter as far as I know. It sounds like your filter is already designed.
I like to find the envelope of an audio signal using matlab, i.e. the red signal in the picture. I have implemented a max-filter but the implementation is very slow. Does matlab have a built in max-filter or some other function that can calculate the envelope? (I have found a median filter but no max-filter)
There is no built-in max filter, but there are user generated functions at the MATLAB File Exchange. For example:
http://www.mathworks.com/matlabcentral/fileexchange/24902-envelope