Skip to main content

Posts

Showing posts from February, 2021

How MATLAB makes the distinction between P-Cores and E-Cores?

  It is known that modern CPUs have both Performance cores (P-cores) and efficiency cores (E-cores), different types of CPU cores that have different purposes and are designed for different tasks. P-cores typically have higher clock speeds and designed for high-performance tasks, while E-cores operate at lower clock speeds and focus on energy-efficient processing. In MATLAB, maxNumCompThreads returns the current maximum number of computational threads. Currently, the maximum number of computational threads is equal to the number of physical cores on your machine. How MATLAB makes the distinction between P-Cores and E-Cores ? NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  ,  Finance 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...

designFilt error ONLY inside function "Incorrect dimensions for matrix multiplication"

  I'm using designFilt to make a simple bandpass filter for some data before doing further analysis:     myfilt = designfilt('bandpassfir','FilterOrder',20, 'CutoffFrequency1',0.1,'CutoffFrequency2',7, 'SampleRate',128); If I run this line directly in the command window, it works just fine. (In my old scripts it worked fine too.) However, when I call it from inside a function embedded in a larger script, I get this error:   Error using designfilt>parseAndDesignFilter (line 516) Incorrect dimensions for matrix multiplication. Check that the number of columns in the first   matrix  matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'.   Error in designfilt (line 224) [err,requestedResponse,parseParams,h] = parseAndDesignFilter(inputParamValueNames, varargin{:});   The code (inserted above) is literally copy-pasted from the script, so I cannot figure out what the difference is. I've trie...

Why Cross Correlation (xcorr) of Two simultaneously Recorded Audio Signals Always return randomly different lags?

  Hi everyone! I'm working on a sound localization project in which I record two audio   signals  simultaneously and then take their 'cross correlation' to find out the "lags" existing between the two signals! But what happens is that every time a random angle is calculated because of the abrupt values of the lags each time! I don't know where I'm going wrong! Please guide me if there is a better approach to achieve a better sound localization ! The code is given as follows: if true fs = 48000 ; %sampling frequency in Hz recObj1 = audiorecorder(fs, 16, 1, 1); recObj2 = audiorecorder(fs, 16, 1, 2); record(recObj1); record(recObj2); pause(5); % record for 5 seconds simultaneously stop(recObj1); stop(recObj2); out1 = getaudiodata(recObj1, 'int16'); out2 = getaudiodata(recObj2, 'int16'); L = out1 ; R = out2 ; t1 = (0:length(L)-1)/fs; t2 = (0:length(R)-1)/fs; figure; plot(t1,L); figure; plot(t2,R); threshold = ...

How do I record the entire row of a matrix if it has a peak value in the third column?

  I have a 3 column   matrix , xyK, that contains x and y coordinates and the value of curvature at each of those coordinates. I'm trying to find the peak values of curvature and the coordinates they occur at and put that information into another 3 column matrix.   findpeaks(xyK(:,3)) is returning the peak values of curvature as I need but when I tried to use [pks,locs] to find the corresponding (x,y) coordinates it's returning the distance along the curve and not the coordinates of the point the curvature occurs at. I suspect this is because the curvature is plotted against length but I have a matrix with all the corresponding values so I feel like there must be a simpler way to just lift out the rows that have a peak value in the third column? function [L,R,C,xyK] = curvature(xy) % Radius of curvature and curvature vector for 2D or 3D curve % [L,R,C] = curvature(X) % X: 2 or 3 column array of x, y (and possibly z) coordiates % L: Cumulative arc length % R: ...

Find quasi-periodic peak locations from noisy photon count data

  I am trying to find the method of locating the gaussian peaks from the photon count data. x axis is the number of photons for each spot and y axis is the counted spots. I used findpeaks function to find peaks. The solid line is created by sgolayfilt.     hgcs = sgolayfilt(hgc, 10, 41); plot(hgc); hold on;plot(hgcs) findpeaks(hgc, 'MinPeakDistance', 20) The peaks that I want to recover are located about 40, 80, 120, and 160.   Question1: Are there any functions or algorithms that can determine the number of peaks and the locations?   Question2: After 160, there are small features. Some of them may be still peaks following the first four peaks. At least, we know that the locations of peaks are quasi-periodic. Could we also find more peaks? 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.Matla...

Why is noise required to get expected Magnitude Squared Coherence (mscohere)

  I am missing something with magnitude Squared Coherence and/or its algorithm. If two signals are compared without or with little noise I get unexpected results. As an example taking from the ML help page:   Fs = 1000; t = 0:1/Fs:1-1/Fs;   x = cos(2*pi*100*t)+sin(2*pi*200*t)+0.5*randn(size(t)); y = 0.5*cos(2*pi*100*t-pi/4)+0.35*sin(2*pi*200*t-pi/2)+ ... 0.5*randn(size(t)); [Pxy,F] = mscohere(x,y,hamming(100),80,100,Fs);   gives the expected two peak response. I would have thought that with no noise the mscohere would be similar and even stronger but it is not. Run the same   code  without the noise   x = cos(2*pi*100*t)+sin(2*pi*200*t); y = 0.5*cos(2*pi*100*t-pi/4)+0.35*sin(2*pi*200*t-pi/2);   [Pxy,F] = mscohere(x,y,hamming(100),80,100,Fs);   and rather than getting two strong peaks and the rest near or at zero, you get unity for all frequencies.   You don't need much noise, 0.5% or -46dB will do. Below this and the results get rea...

Savitsky-Golay Filter Problem - Smoothing 3D line

  I wanted to smooth a 3d line using the Savitzky-Golay filter, but for this example is seems to not work properly. Any ideas why, and how to fix it?     % Savitzky–Golay filter (sgolayfilt) - smoothing individual axes windowWidth = 27; %Standard example values polynomialOrder = 3; xsg=sgolayfilt(points(:,1),polynomialOrder, windowWidth); ysg=sgolayfilt(points(:,2),polynomialOrder, windowWidth); zsg=sgolayfilt(points(:,3),polynomialOrder, windowWidth); xyzsg = [xsg,ysg,zsg]; clf() hold on plot3(points(:,1),points(:,2),points(:,3),'bo') plot3(xyzsg(:,1),xyzsg(:,2),xyzsg(:,3),'gx') hold off 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. How many el...

Removing spikey data from a sensor readout.

  I have a loop which reads out a sensor, once in a while the data is completely off, and gives a spike. I would like to remove those spikes.   The data given moves from -180 to 180 degrees, so when my measurement moves from -180 to 180 this should not be filtered (as this is normal).   However, if it moves from -180 to 90 then this counts as a spike.   It's not possible to do data processing after getting every readout, ideally there should be a filter of some sort in the loop itself. 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. Do you have the  Signal Processing Toolbox?  If so, you could use the median filter. If you want to repla...

spectrogram error in matlab

  Hello, I am trying to plot a spectrogram using MATLAB at home but I am getting the following error:   Undefined function 'spectrogram' for input arguments of type 'double'. 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 ver to see if you have the  Signal Processing Toolbox . If you don't contact the sales department.     >> ver ------------------------------------------------------------------------ MATLAB Version: 8.5.0.197613 (R2015a) MATLAB License Number: ****** Operating System: Microsoft Windows 7 Enterprise Version 6.1 (Build 7601: Service Pack 1) Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 6...

converting a horizontal matrix to vertical

  Hello. I am trying to convert a 100*2   matrix  to 2*100 matrix. I appreciate if you give me any idea. The reason is I need to find the pick of negative data at second column, and I am using following code:     NEG=[find(E(:,1)<0) E(E(:,1)<0,1)]; so for using following code I need my matrix be 2*100 EE=findpeaks(NEG(:,2)); 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   transpose , which can also be written   .'     >> A = [1,2;3,4;5,6;,7,8] A = 1 2 3 4 5 6 7 8 >> A.' ans = 1 3 5 7 2 4 6 8

Why standard Waveform from audio out gets distorted when i reduce the amplitude?

  In my attempt to generate a standard sine wave out of a sound card, i started using   matlab  which has a function soundsc for scaling the output     t = 0:1/48000:10; y = sin(1000*2*pi*t); soundsc(y,48000,[a b]); its ok when my a and b are -1 and 1 respectively, when i try to make them even -0.9 and 0.9 respectively the standard sine wave of 1Khz gets distorted why so ?   are our sound cards will not be able to handle standard sounds ?? 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. The reason for this distortion is that some of the   signal  values are being clipped. When you specify [a, b], it is assumed tha...

Can Matlab be started without certain toolboxes?

  I have a license with multiple toolboxes, some of which I never need. Can I configure a start script that does not automatically load all the toolboxes? 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 can remove the path of the toolbox that you do not want loaded from   MATLAB  search path. To find the path of all the toolboxes installed use the command:   >> path To remove that path of a specific toolbox, use the command:     >> rmpath('put the path of the toolbox here') For example, to remove the Wavelet Toolbox you can execute:     >> rmpath([matlabroot '\toolbox\wavelet\wavelet']) In order to a...

how to plot or put the function ( wvtool ) in my gui axis1

  please i would like to know how to put that function ( wvtool ) in my GUI interface as example i will put this code in any pushbottom and will show it in my GUI axis1 ?? L = 64; wvtool(hamming(L)) 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. No, you cannot do that. wvtool() is a GUI with a toolbar and multiple  axes of plots.  In MATLAB, it is not possible for a GUI to be contained within an axes. GUIs that do not have toolbars can be placed inside uipanel, but not inside an axes.   You could record the figure handle returned from wvtool() and locate the axes inside the figure and move them to a container object in your original figure. The...