Skip to main content

Posts

Showing posts from January, 2021

Stretch the dynamic range of the given 8-bit grayscale image using MATL...

Using cellfun for multidimensional cell

  I have a cell of this type:   200×3 cell array [1×60000 double] [ -0.9365] [154.9924] [1×60000 double] [ 10.8080] [297.1132] [1×60000 double] [ 15.5680] [121.3598] Etc. I want to use the cusum function, where the second column and third columns are inputs. For a single row this would be:   cusum(this_cell{j}, constant, constant, this_cell{j,2}, this_cell{j,3})   What would be syntax for using cellfun? ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. I don't have the  Signal Processing Toolbox , so I can't access the cusum function. However, here is a generic example of using three inputs into cellfun, that you should be able to easily craf

Comb filtering when sampling frequency is not multiplicative of the interference fundamental frequency

  Hi all,   I would like to apply a notch comb filter (e.g. by using the iircomb function), but my sampling frequency is 976 Hz and the fundamental frequency of the noise signal is 50 Hz.   Any ideas of how I could achieve that would be greatly appreciated. An alternative would be to use multiple notch filters (e.g. iirnotch) but this would increase dramatically the associated computational costs. ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. You have to change the Sampling frequency such that you can get the sampling frequency to be a multiple of noise frequency.   You can do this my a combination of down-sampling and up-sampling. Find a fraction such that the sampling frequen

How to deal with this error??

  A model of the surface EMG signal is created by filtering a white gaussian noise, using a shaping filter H(f). this filter has low cut-off freq=60hz and high cut-off freq=120hz. this is my code but i don't know how to deal with   Undefined function 'designfilt' for input arguments of type 'char' .   clear all; subplot(322); load nnoise.m; plot(nnoise,'k'); % design shaping filter bpFilt = designfilt('bandpassfir',... 'CutoffFrequency1',60,'CutoffFrequency2',120, ... 'SampleRate',2000); subplot(323); W = filter(bpFilt,nnoise); plot(W,'k');title ('EMG'); ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects

FindPeaks() of a 1024 x 116 Matrix

  I have a matrix that I read into MatLab that is 116 spectra (columns) each being 1024 elements (rows). Each spectrum has a peak and I'm looking to determine the following information from each spectrum: - Peak value - Peak position - Peak width at a set height, like 10% or 30% of the peak height. What I'd really like is to know the first and last x element of each peak   I've completed the Signal Processing Toolbox course and it didn't go over the FindPeaks() function. Please, any help would be greatly appreciate. Even if it's direction to a good source on the function. Thank you! ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and  research. findpeaks  only works on vect

Sum five elements before a specific number

  Hi,  I used "findpeaks" to find the IDs of all the peaks in my data. I need for each peak to find the average of five elements before it. the problem is that some of the peaks don't have five elements before it (say the second value is a peak, therefore, there is only one value before it). How can I tell matlab to average whatever is available but not more than 5 elements? ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and  research. data_before = Yourdata(max(1, idx-5) : idx-1) Note that in the case that idx is 1, this will give the empty result, as "empty"   is  all of the data that is available   before  the location.

Trying to make a chirp (sweep) in matlab with random frequency

  Hi guys!   I have been trying to make a chirp function in which the frequency is changing randomly through the time   my parameters are this t1=0 t2=1 f1=0 f2=60   I have tried the chirp function of matlab, however, the frequency is linearly increasing but I also want that it could decrease.   Any ideas?   Thanks in advance ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and  research. It's not really a chirp if you want to have the frequencies vary more or less randomly up and down. But anyway, to make a   signal  with random frequencies:   t = linspace(0, 100, 400); amplitude = 3; % Make random frequencies. frequency = .04 + .04 * rand(1, length(t)); % Construct waveform. y = amplitude

question about the signal smoothing example

  Hello,   I have a question about the   signal  smoothing example given in the  documentation of Matlab.   load bostemp   days = (1:31*24)/24; plot(days, tempC) axis tight ylabel('Temp (\circC)') xlabel('Time elapsed from Jan 1, 2011 (days)') title('Logan Airport Dry Bulb Temperature (source: NOAA)') I understand that this example wants to emphasize that the measurements are taken 24 hours a day, 31 days for January. So the variable 'days' ranges from 1 to 31*24. But why divide it by 24?   Also, hoursPerDay = 24; coeff24hMA = ones(1, hoursPerDay)/hoursPerDay; avg24hTempC = filter(coeff24hMA, 1, tempC); plot(days,[tempC avg24hTempC]) I understand that this example refers to the moving average of length N (in this case N = 24). I don't understand why there is a need to set N = 24. Why can't it be just N = 1? ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multipl

error in returning widths over iterated findpeaks

  Hi, I am trying to use findpeaks over a matrix, x, column by column. I am using a for loop as below:   for k=1:size(x,2) [P{k},locs{k},widths,proms{k}]=findpeaks(x(:,k)) end Everything is working fine except for returning widths. P, locs and proms all return as cell arrays with all the data for the peaks in each column. However, widths only returns the widths of the peaks for the last column. When I try to edit it by making widths return as a cell array: for k=1:size(x,2) [P{k},locs{k},widths{k},proms{k}]=findpeaks(x(:,k)) end I get the error message "Cell contents assignment to a non-cell array object"   Is there a way to get this function to return all the widths of all the peaks for each column? ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100

collect 400 samples from a LFM (5MHz bandwidth) signal modulated on 18GHz

  f_sweep = 5e6; fs = f_sweep * 4.121; sLFM = phasedLinearFMWaveform('SampleRate',fs,'SweepBandWidth',f_sweep,'PulseWidth',1e-3); lfmwav = setp(sLFM); collector = phase.WidebandCollector('Sensor',URA, 'SampleRate',fs,'CarrierFrequency',18e9); S1=awgn(lfmwav,-10,'measured'); Y=collector(S1(1:400),[20;30]); ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and  research. Your sampling rate is set at fs, which is about 20 MHz, this means your Nyquist is about 10 MHz, regardless what your carrier is, i.e., your   signal  is aliased. If you want to see 18 GHz at the center, you will have to sample at 36 GHz, this is obviously very expensive.  SE

fft dim parameter when ndims(x) > 2

  fft dim  shows how dim parameter is used for multidimensional   signals  of ndims(X) = 2 When ndims(X) > 2 how is it used? (I cannot use   fftn  here.) ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and  research. If you have a multidimensional   array  x, say   x = ones(3,4,5) then fft(x,[],3) will perform FFT on the dimension with 5 elements, and so on.

How to calculate period of signal with matlab

  Hi , I have the signal x2(t)=|cos(10*pi*t)|.How can i calculate its period with matlab?I am new   matlab  so each help will be usefull ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and   research. use autocorrelation. If your data is periodic you should get high correlation once the lag time matches the period. here is an example: x=0:0.1:20*2*pi; y=sin(x); % so we know the period is 2*pi roughly 6.28 ac=xcorr(y,y); [~,locs]=findpeaks(ac); mean(diff(locs)*0.1) ans = 6.2842 In a more complex data set including some noise you need to work around the find peaks a little bit. That might be too noisy.

How to apply bandpass filter

  The  signal file is of 20Hz sampling rate. Each row is a  signal , i needed to to apply bandpass filter to each row and convert it in the frequency range 0.34 - 1 Hz. ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. D = load('ehgSignal.mat'); s = D.val'; Fs = 20; % Sampling Frequency (Hz) Fn = Fs/2; % Nyquist Frequency (Hz) Wp = [0.34 1.00]/Fn; % Passband Frequencies (Normalised) Ws = [0.30 1.05]/Fn; % Stopband Frequencies (Normalised) Rp = 10; % Passband Rippl