Legend matlab

DataVisualisations

2015.04.12 23:05 ThePlanckConstant DataVisualisations

A subreddit for effective visualizations of data
[link]


2023.06.08 18:40 Creative_Sushi Tried new pivot function to summarize table - very nice

Tried new pivot function to summarize table - very nice
I just used the new pivot function for the first time and it was super easy and nice. If you love pivot tables in Excel, you will love this as well.
I will use the data from the MATLAB Subreddit RSS feed. You can download getReddit function here.
% get RSS feed s = getReddit(subreddit='matlab',sortby='hot',limit=100,max_requests=1); % extract data into table T = table; T.Flair = arrayfun(@(x) x.data.link_flair_text, s, UniformOutput=false); T.Flair(cellfun(@isempty,T.Flair)) = {''}; T.Flair = string(T.Flair); T.Created_UTC = datetime(arrayfun(@(x) x.data.created_utc, s), "ConvertFrom","epochtime"); % convert the table to timetable T = table2timetable(T,"RowTimes","Created_UTC"); % remove the pinned posts isPinned = year(T.Created_UTC) < 2023; T(isPinned,:) = []; 
Now I would like to summarize the table by "Created_UTC" and "Flair" using the new pivot function.
pvT = pivot(T,Columns="Flair",Rows="Created_UTC",RowsBinMethod="week") 
Pivoted table
Very simple.
I can also plot it, too.
figure for ii = 2:size(pvT,2) plot(pvT.week_Created_UTC,pvT.(ii)) hold on end hold off ylabel("Posts") vars = pvT.Properties.VariableNames; legend(vars(2:end),Location="northwest") title("MATLAB Subreddit Posts by Flair") 
Plot from the pivoted table
I think I will ditch groupsummary and start using this.
submitted by Creative_Sushi to matlab [link] [comments]


2023.06.07 20:32 Obvious-Crow-2416 ~2K Work and Gaming Setup

What will you be doing with this PC? Be as specific as possible, and include specific games or programs you will be using.
Mix of work (working with data in python, Photoshop and Illustrator, Zoom, GraphPad Prism, MATLAB) and options for gaming as well (league of legends, final fantasy 14, final fantasy 16, elden ring)
What is your maximum budget before rebates/shipping/taxes?
All in would be around 2k with monitor, webcam, audio, etc but can be less
When do you plan on building/buying the PC? Note: beyond a week or two from today means any build you receive will be out of date when you want to buy.
Now
What, exactly, do you need included in the budget? (ToweOS/monitokeyboard/mouse/etc)
Tower, CPU, CPU Cooler, Motherboard, RAM, SSD, GPU, PSU, monitor, webcam, wireless keyboard+mouse, speaker, microphone
Which country (and state/province) will you be purchasing the parts in? If you're in US, do you have access to a Microcenter location?
California, US not going to Microcenter
If reusing any parts (including monitor(s)/keyboard/mouse/etc), what parts will you be reusing? Brands and models are appreciated.
No
Will you be overclocking? If yes, are you interested in overclocking right away, or down the line? CPU and/or GPU?
No
Are there any specific features or items you want/need in the build? (ex: SSD, large amount of storage or a RAID setup, CUDA or OpenCL support, etc)
~2TB SSD
27" monitor
wifi
Do you have any specific case preferences (Size like ITX/microATX/mid-towefull-tower, styles, colors, window or not, LED lighting, etc), or a particular color theme preference for the components?
No
Do you need a copy of Windows included in the budget? If you do need one included, do you have a preference?
Yes, 11
submitted by Obvious-Crow-2416 to buildapcforme [link] [comments]


2023.05.30 10:14 AggravatingNobody201 [For Hire] For Help in MATLAB MATHS (CALCULUS 1,2,3 /Linear Algebra, Real Analysis, Discrete maths ) STATISTICS including R and SPSS ENGINEERING (THERMODYNAMICS AND FLUIDS) Add discord : young legend#6233 for good grades,VOUCHES available on request for proof.

Hello guys, I’m an expert with quality experience In the above mentioned courses. I have successfully assisted students with assignments, tests and exams. A trial will convince you. Vouches are available on request
Add discord : young legend#6233 or Contact: [email protected] for good grades
Cheers.
submitted by AggravatingNobody201 to freelance_forhire [link] [comments]


2023.05.30 10:12 AggravatingNobody201 For Help in MATLAB ,MATHS (CALCULUS 1,2,3 /Linear Algebra, Real Analysis, Discrete maths ) STATISTICS including R and SPSS ENGINEERING (THERMODYNAMICS AND FLUIDS) Add discord : young legend#6233 or Contact: [email protected] for good grades,VOUCHES available on request for proof.

Hello guys, I’m an expert with quality experience In the above mentioned courses. I have successfully assisted students with passing and getting high grades in their assignments, tests and exams. A trial will convince you. Vouches are available on request
Add discord : young legend#6233 or Contact: [email protected] for good grades
Cheers.
submitted by AggravatingNobody201 to Students_AcademicHelp [link] [comments]


2023.05.30 10:10 AggravatingNobody201 For Help in MATLAB ,MATHS (CALCULUS 1,2,3 /Linear Algebra, Real Analysis, Discrete maths ) STATISTICS including R and SPSS ENGINEERING (THERMODYNAMICS AND FLUIDS) Add discord : young legend#6233 or Contact: [email protected] for good grades,VOUCHES available on request for proof.

Hello guys, I’m an expert with quality experience In the above mentioned courses. I have successfully assisted students with passing and getting High grades in their assignments, tests and exams. A trial will convince you. Vouches are available on request
Add discord : young legend#6233 or Contact: [email protected] for good grades
Cheers.
submitted by AggravatingNobody201 to schoolhelper [link] [comments]


2023.05.29 01:18 GTShadowking Looking for a 2-in-1 laptop that will last

$2000 CAD
No
I would like a 2-in-1 like the hp envy. I currently have one but the hinge broke so I’m looking for a different laptop this time. Something that does not have that same issue.
Not very important
Something big like 15” or higher? If not that is fine
Matlab, AutoCAD, league of legends, one note
Just league of legends. No preference as long as there are no gpu errors like the envy
Touch screen with the ability to fold into a tablet or some other easy way to write on screen. SSD, 16gb ram, 500 gb storage or more
submitted by GTShadowking to u/GTShadowking [link] [comments]


2023.05.27 10:02 asteroidalex Combining Graphs- Nothing is being plotted

Hi all,
I am trying to combine two graphs in MATLAB, but only neither of the graphs end up being plotted, and I am not sure why?
AlphaNone=readmatrix('turntable1_Alpha_No_absorber.txt'); H=histogram(AlphaNone); %% Generates histogram of data set HV=H.Values; HVBAR=HV/1774; %%% Convert to probabilities R=range(AlphaNone); M=mean(AlphaNone); %% Using the Range and Mean of this data enabes up to simulate a Poisson Distribution x = 0:R; y = poisspdf(x,M); figure hold on yyaxis left bar(x,y,1) xlabel('Counts') ylabel('Probability') yyaxis right bar(x,HVBAR,1) ylabel('Probability') legend('Simulated Distribution', 'Experimental Distribution') title('Alpha Radiation with no Absorber') hold off
submitted by asteroidalex to matlab [link] [comments]


2023.05.21 09:35 inundatedriver pc for post undergrad engineer / gamer

>**What will you be doing with this PC? Be as specific as possible, and include specific games or programs you will be using.**
i am finishing up my undergrad in aerospace engineering in june, and would love to get a nice pc for personal projects and gaming. i have little knowledge in this area and need help researching/building. im aiming to ruin CAD such as solidworks and siemens nx, software such as ANSYS and matlab, and games such as apex, league of legends, and the last of us
>**What is your maximum budget before rebates/shipping/taxes?**
~$1800
>**When do you plan on building/buying the PC? Note: beyond a week or two from today means any build you receive will be out of date when you want to buy.**
beginning of july
>**What, exactly, do you need included in the budget? (ToweOS/monitokeyboard/mouse/etc\)**
all the components please. keyboard recs for gaming would be appreciated (a size similar to a mac keyboard is appreciated).
>**Which country (and state/province) will you be purchasing the parts in? If you're in US, do you have access to a Microcenter location?**
CA USA, i have access to a microcenter
>**If reusing any parts (including monitor(s)/keyboard/mouse/etc), what parts will you be reusing? Brands and models are appreciated.**
not reusing anything
>**Will you be overclocking? If yes, are you interested in overclocking right away, or down the line? CPU and/or GPU?**
if anyone could explain this a bit more in depth it'd be appreciated. from what i understand it helps improve the performance of running tasks, but would this be necessary for my usage? for now i will say no, but perhaps down the line
>**Are there any specific features or items you want/need in the build? (ex: SSD, large amount of storage or a RAID setup, CUDA or OpenCL support, etc)**
as long as it can comfortably run the software listed above
>**Do you have any specific case preferences (Size like ITX/microATX/mid-towefull-tower, styles, colors, window or not, LED lighting, etc), or a particular color theme preference for the components?**
a non chunky tower for moving purposes would be nice, but not necessary. as for the colors, im not too picky, but some customization would be preferable
>**Do you need a copy of Windows included in the budget? If you do need one included, do you have a preference?**
i need a copy, but preference in terms of what? newest windows unless for some reason an older version would suffice
>**Extra info or particulars:**
i really am new to this, so i appreciate any help. ill be sure to do my due diligence and do any more research with suggestions. thanks!
submitted by inundatedriver to buildapcforme [link] [comments]


2023.05.14 11:58 daniel655422 Digital communication- operations on some cosines (samples filters reconstructions and such)

Hey folks, what's going on?
so...I received some matlab assignments from submit to my dear professor:
I can use the following data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all; clear all; clc; %% Tc=1/400; % sampling period of "continuous signal" [sec] Ts=1/50; % sampling period [sec] f0=10; % frequency of the signal [Hz] tc=0:Tc:0.4; % time axis of continuous signal ts=0:Ts:0.4; % time axis of sampeled signal %% Xc=cos(2*pi*f0*tc); % continuous signal Xs=cos(2*pi*f0*ts); % sampeled signal %% fh = figure(1); fh.WindowState = 'maximized'; % full screen plot plot(tc,Xc,'b','linewidth',3) hold on stem(ts,Xs,'.r','linewidth',3,'markersize',20) xlabel('Time [Sec]') legend('Continuous signal','Sampeled signal') set(gcf,'color','w'); % white background 
For the purpose of illustrating the continuous signal, an interval between samples Tc of 1/400 seconds was set for it.
This is the interval for it
We will present and restore the signal at the end. Ts is the interval between the samples and is equivalent to the sampling frequency, this variable will change accordingly
to the task
f0 is the frequency of the signal and will change depending on the task.
Given the following signals: 1. 𝐶𝑜𝑠(2𝜋10𝑡) 2. 𝐶𝑜𝑠(2𝜋20𝑡) 3. 𝐶𝑜𝑠(2𝜋30𝑡) 4. 𝐶𝑜𝑠(2𝜋40𝑡) 5. 𝐶𝑜𝑠(2𝜋10𝑡)+2𝐶𝑜𝑠(2𝜋30𝑡) when the sampling frequency is fs=50Hz
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Assignment 1:
For each of the signals build the following output:
Subfigure 1
Subfigure 2
Where sub-figure 1 contains the continuous signal and the sampled signal and sub-figure 2 contains the productive transform of the sampled signal. explanation
the results you got.
Assignment 2:
In order to avoid the phenomenon of spectrum aliasing, before the sampling operation, the signal must be filtered with an LPF filter
suitable
For this purpose a 2nd order butterwort type filter was chosen.
a. Use the filterDesigner tool and select the appropriate filter and attach its transfer function.
b. To validate the filter, construct a white noise corresponding to the sampling frequency of the signal and pass it through the filter and show the
The spectrum of the noise before and after filtering.
c. Repeat section b for each of the defined signals.
Assignment 3:
For the purpose of the reconstruction operation, we will define a number axis corresponding to the definition of the continuous signal (according to Tc). At each point in time we have a sample,
The sample will appear and all other places will have zeros. For each of the signals construct the following output:
Subfigure 1
Subfigure 2
Where sub-figure 1 contains the signal in the timeline and sub-figure 2 contains the derivative transform of the signal. Explain the results
you got
Assignment 4:
As we saw in assignment 3, since we have partial information about the reconstructed signal we got a phenomenon of "spectral duplication". as my hand
To overcome the phenomenon and get a desired reproduced signal it is necessary to "smooth the signal". The swipe operation is a filter type operation
LPF when the filter must be chosen correctly.
a. Explain the considerations for choosing the filter.
b. Use a 2nd order butterwort filter and smooth the signal.
c. Use an ideal filter (Sinc train as we saw in the lecture).
For sections b,c, describe and show the transfer function of the selected filter. Show the productive transformation of the signals
before and after the filtering operation.
d. Show in the timeline the original signal versus the reconstructed signal for the two filters from sections b,c. If accepted
Delay between signals Explain the meaning and/or lack of delay obtained
Assignment 5:
Data from two uniform quantifiers with 8 and 16 quantification levels respectively. The value of their extreme levels is ±1.
The following signals enter the quantizer:
a. y=x , -1.5 b. 𝑦=𝐶𝑜𝑠(2𝜋20𝑡)
c. 𝑦=𝐶𝑜𝑠(2𝜋10𝑡)+ 0.5𝐶𝑜𝑠(2𝜋25𝑡)
d. y~U[-1,1]
e. y~U[-2,0]
f. y~U[-2,2]
g. y~N(0,0.2)
h. y~N(0,0.4)
i. y~N(-0.5,0.5)
Plot the original signal, the quantized signal and the quantized noise for the first three signals and calculate the resulting SQNR
for all signals.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%I think EX1 is good this is what I tried%
clear;clc;close all;%%Tc=1/400; % constant sampling period of "continuous signals" [sec]Ts=1/50; % new given sampling period [sec]fs=1/Ts; % new given sampling frequency [Hz]f0=10; % frequency of the first signal [Hz]tc=0:Tc:0.4; % time axis of continuous signalts=0:Ts:0.4; % time axis of sampeled signalf1234=f0*[1 2 3 4]; % frequencies for the first 4 cos wavesXccounter=zeros(4,length(tc)); % matrix of zeros for continuous signalsXscounter=zeros(length(f1234)+1,length(ts)); % matrix of zeros for sampeled signals%%for i=1:4 % for loop 1 to create array of the first 4 signalsXccounter(i,:)=cos(2*pi*f1234(i)*tc); % continuous signalsXscounter(i,:)=cos(2*pi*f1234(i)*ts); % sampeled signalsend % end of loop 1%%Xccounter(5,:)=Xccounter(1,:)+2*Xccounter(3,:); % assign the fifth continuous signal value to arrayXscounter(5,:)=Xscounter(1,:)+2*Xscounter(3,:); % assign the fifth sampeled signal element to arrayfor ii=5:-1:1 %for loop 2 to create the subplots and calculate the fourier transformstat=figure(ii);% tat.WindowState='maximized'; % full screen plotssubplot(2,1,1)p1=plot(tc,Xccounter(ii,:),"r",'linewidth',1,"markersize",18);hold ons1=stem(ts,Xscounter(ii,:),"*b","linewidth",1,"markersize",7);xlabel('Time [Sec]')legend('Continuous signal','Sampeled signal',"Location","bestoutside")legend('boxoff')grid ontitle(['Signal',num2str(ii)]) % add title to subplothold offsubplot(2,1,2)Xsf=abs(fftshift(fft(Xscounter(ii,:))));f=linspace(-fs/2,fs/2,length(Xsf)); % calculate frequency range% Find the main frequency points of the two deltas for each cosine[~,idx_max]=max((Xsf)); % Find the index of maximum value and corresponding frequencyf_max =abs(f(idx_max));hold onp2=plot(f,(Xsf),"r",'linewidth',1,"markersize",18);s2=stem(f,(Xsf),"*b",'linewidth',1,"markersize",7);xlabel('Frequency [Hz]')title(['Fourier Transform of Signal',num2str(ii)])% add title to subplotsyline(Xsf(idx_max),"g",['f_{max} =',num2str(f_max),'Hz'],'LabelHorizontalAlignment','center','LabelVerticalAlignment','bottom','LineStyle',':','LineWidth',3);xline([-f_max,f_max],"g",'f_{ 0}±','LabelOrientation','horizontal','LineStyle',':','LineWidth',3);l2=legend([p2 s2],"Sampled Signal fft","Signal fft","Location","bestoutside");legend('boxoff')grid onpause(0.25)end
%I think EX2 is bad because i stil getting Alasing and dont see the fft in the original freq of the signal is what I tried%
I guess we all know the legendary Shannon and the mighty Nyquist with their theory of good lossless sampling,I don't know why, but when I asked the professor in class, he told me to build the filter like this, so I would appreciate an explanation as to why we don't set fs=80, which anyway is 2 times greater than the maximum frequency of the cos, but FS=400?
https://ibb.co/nRbtxC2
first try of EX2:
close all;clear;clc;%% EX2a %%load("LPF.mat","Fs400fs25"); % Load the filter object from the .mat fileLPF=Fs400fs25; % assigns the value "Fs400fs25" to the variable LPF[numerator,denominator]=tf(LPF); % obtain the transfer function% sys=tf(numerator,denominator);%end of EX2a%Tc=1/400; % constant sampling period of "continuous signals" [sec]Ts=1/50; % new given sampling period [sec]fs=50; % new given sampling frequency [Hz]f0=10; % frequency of the first signal [Hz]tc=0:Tc:0.4; % time axis of continuous signalts=0:Ts:0.4; % time axis of sampeled signalf=linspace(-fs/2,fs/2,length(tc)); % calculate frequency range%% EX2b %%noice=randn(size(tc));filltnoice=filter(LPF,noice);noicespectrum=abs(fftshift(fft(noice)))/length(tc);filltnoicespectrum=abs(fftshift(fft(filltnoice)))/length(tc);figure(6)subplot(2,1,1)plot(tc,noice,"r",tc,filltnoice,'b')legend('unfilltered noice red','filltered noice blue')title("white noice")subplot(2,1,2)plot(f,noicespectrum,"r",f,filltnoicespectrum,"b")hold onstem(f,noicespectrum,"r")stem(f,filltnoicespectrum,"b")legend('unfilltered fft red','filltered fft blue')title("noice spectrum")%end of EX2b%%% EX2c %%f1234=f0*[1 2 3 4]; % frequencies for the first 4 cos wavesXccounter=zeros(length(f1234),length(tc)); % matrix of zeros for continuous signalsXscounter=zeros(length(f1234),length(ts)); % matrix of zeros for sampled signalsfor i=1:4 % for loop 1 to create array of the first 4 signalsXccounter(i,:)=Xccounter(i,:)+cos(2*pi*f1234(i)*tc); % continuous signalsXscounter(i,:)=Xscounter(i,:)+cos(2*pi*f1234(i)*ts); % sampeled signalsend % end of loop 1Xccounter(5,:)=Xccounter(1,:)+2*Xccounter(3,:); % assign the fifth continuous signal value to arrayXscounter(5,:)=Xscounter(1,:)+2*Xscounter(3,:); % assign the fifth sampeled signal element to arrayfor ii=5:-1:1 %for loop 2 to create the subplotstat=figure(ii);% tat.WindowState='maximized'; % full screen plotssubplot(4,1,1)plot(tc,Xccounter(ii,:),'r','linewidth',3)hold onstem(ts,Xscounter(ii,:),'.g','linewidth',3,'markersize',20)xlabel('Time [Sec]')ylabel('Amplitude [TD]')legend('Continuous signal red','Sampeled signal green')title(['Signal',num2str(ii)]) % add title to subplothold offsubplot(4,1,3)Xsf=abs(fftshift(fft(Xccounter(ii,:))))/length(tc);plot(f,Xsf,'r')legend('Fourier Transform of Sampled Signal r')title(['Signal',num2str(ii)]) % add title to subplotxlabel('Frequency [Hz]')ylabel('Amplitude [FD]')subplot(4,1,4)xsfilt=abs(fftshift(fft(filter(LPF,Xccounter(ii,:)))));plot(f,xsfilt/length(tc),'b')xlabel('Frequency [Hz]')ylabel('Amplitude [FD]')legend("Fourier Transform of Sampled filtered Signal b")title(['Signal',num2str(ii)]) % add title to subplotxlabel('Frequency [Hz]')ylabel('Amplitude [FD]')subplot(4,1,2)plot(tc,filter(LPF,Xccounter(ii,:)),'b','linewidth',3)hold onstem(ts,Xscounter(ii,:),'.g','linewidth',3,'markersize',20)xlabel('Time [Sec]')ylabel('Amplitude [TD]')legend('Continuous filltered signal blue','Sampeled signal green')title(['Signal',num2str(ii)]) % add title to subplothold off;end%end of EX2c%
second try of EX2:
clear;clc;close all;%%Tc=1/400; % constant sampling period of "continuous signals" [sec]Ts=1/50; % new given sampling period [sec]fs=1/Ts; % new given sampling frequency [Hz]f0=10; % frequency of the first signal [Hz]tc=0:Tc:0.4; % time axis of continuous signalts=0:Ts:0.4; % time axis of sampeled signalf=linspace(-fs/2,fs/2,length(tc)); % calculate frequency rangef1234=f0*[1 2 3 4]; % frequencies for the first 4 cos wavesXccounter=zeros(4,length(tc)); % matrix of zeros for continuous signalsXscounter=zeros(length(f1234)+1,length(ts)); % matrix of zeros for sampeled signals%%%load("LPF.mat","Fs400fs25"); % Lתoad the filter object from the .mat fileLPF_1=Fs400fs25; % assigns the value "Fs400fs25" from the structure "matcontents" to the variable[numerator,denominator]=tf(Fs400fs25); % obtain the transfer functiontransferfunction=tf(numerator,denominator);%%%%%for i=1:4 % for loop 1 to create array of the first 4 signalsXccounter(i,:)=cos(2.*pi.*f1234(i).*tc); % continuous signalsXscounter(i,:)=cos(2.*pi.*f1234(i).*ts); % sampeled signalsend % end of loop 1%%Xccounter(5,:)=Xccounter(1,:)+2.*Xccounter(3,:); % assign the fifth continuous signal value to arrayXscounter(5,:)=Xscounter(1,:)+2.*Xscounter(3,:); % assign the fifth sampeled signal element to arrayfor ii=1:5 %for loop 2 to create the subplots and calculate the fourier transformstat=figure(ii);tat.WindowState='maximized'; % full screen plotssubplot(2,1,2)hold onXsf=abs(fftshift(fft(filter(LPF_1,Xccounter(ii,:),2))))/length(tc);p2=plot(f,(Xsf),"r",'linewidth',1,"markersize",18);s2=stem(f,(Xsf),"*b",'linewidth',1,"markersize",7);% Find the main frequency points of the two deltas for each cosine[~,idx_max]=max((Xsf)); % Find the index of maximum value and corresponding frequencyf_max =abs(f(idx_max));xlabel('Frequency [Hz]')title(['Fourier Transform of Signal',num2str(ii)])% add title to subplotsyline(Xsf(idx_max),"g",['f_{max} =',num2str(f_max),'Hz'],'LabelHorizontalAlignment','center','LabelVerticalAlignment','bottom','LineStyle',':','LineWidth',3);xline([-f_max,f_max],"g",'f_{ 0}±','LabelOrientation','horizontal','LineStyle',':','LineWidth',3);l2=legend([p2 s2],"Sampled Signal fft","Signal fft","Location","bestoutside");legend('boxoff')grid onhold offsubplot(2,1,1)p1=plot(tc,filter(LPF_1,Xccounter(ii,:)),"r",'linewidth',1,"markersize",18);hold ons1=stem(ts,Xscounter(ii,:),"*b","linewidth",1,"markersize",7);xlabel('Time [Sec]')legend('Continuous signal','Sampeled signal',"Location","bestoutside")legend('boxoff')grid ontitle(['Signal',num2str(ii)]) % add title to subplothold offpause(0.2)end
ex 3:
clc;clear;close all;%% Define constants and parametersTc=1/400; % constant sampling period of "continuous signals" [sec]Ts=1/50; % new given sampling period [sec]fs=1/Ts; % new given sampling frequency [Hz]f0=10; % frequency of the first signal [Hz]tc=0:Tc:0.4; % time axis of continuous signalts=0:Ts:0.4; % time axis of sampled signalf1234=f0*[1 2 3 4]; % frequencies for the first 4 cos waves%% Matrix of zeros for continuous and sampled signalsXccounter=zeros(length(f1234)+1,length(tc)); % matrix of zeros for continuous signalsXscounter=zeros(length(f1234)+1,length(ts)); % matrix of zeros for sampled signals%% Create the first 4 signalsfor i = 1:4Xccounter(i,:)=Xccounter(i,:)+cos(2*pi*f1234(i)*tc); % continuous signalsXscounter(i,:)=Xscounter(i,:)+cos(2*pi*f1234(i)*ts); % sampled signalsend%% Assign the fifth signal value to the sum of the first and third signalsXccounter(5,:)=Xccounter(1,:)+2*Xccounter(3,:); % assign the fifth continuous signal value to arrayXscounter(5,:)=Xscounter(1,:)+2*Xscounter(3,:); % assign the fifth sampled signal element to array%% create the subplotsfor ii=1:5figure(ii); % create figure% Plot the continuous and sampled signals in time domainsubplot(2,1,1)not_filtered=Xccounter(ii,:);plot(tc,not_filtered,'b','linewidth', 2);hold onstem(ts, Xscounter(ii,:), 'r', 'linewidth',1,'markersize',2);xlabel('Time [sec]');ylabel('Amplitude [V]');legend('Continuous signal', 'Sampled signal');title(['Signal',num2str(ii)]);hold off% Compute Fourier transform of the signal with zero-paddingN=length(tc);Xspadded=[Xscounter(ii,:),zeros(1,N*7)]; % zero-pad the signal% Plot the Fourier transform of the signalsubplot(2,1,2)fourier_on_unfiltered_cosines=abs(fftshift(fft(Xccounter(ii,:),N*8)));fourier_on_filtered_cosines=abs(fftshift(fft(Xspadded,N*8)));f=linspace(-fs/2,fs/2,length(fourier_on_unfiltered_cosines));plot(f,fourier_on_filtered_cosines,'b','linewidth',2);xlabel('Frequency [Hz]');ylabel('Amplitude [V]');legend('Fourier transform of sampled signal');title(['Signal',num2str(ii)]);end% End of ExerciseI've been sitting on this for several nights in a row and I'm living on coffee, stimulants, and energy drinks, please help me fall asleep (only if I finish this assignment will I go to sleep)
My questions are as follows:
  1. What do you think about the code, suggestions for improvement or preservation?
  2. Why am I trying to display the signals from assignment 1 in relation to the filtered signal in assignment 2 from the moment I used the filter (no matter which line and which display command) so everything is similar to the filtered one?
  3. I'll be honest with you, it seems to me that task 3 required zero padding or something, I couldn't really understand even though I tried with all my might, so I asked for help from GPT, but I don't think that's what they asked for, so could you please tell me what task 3 requires me to do?
  4. In the hope that we will reach a solution of 2 and I can go rest for a few hours. Do you have any suggestions, hints, instructions and instructions that will help me understand the rest of the questions (read about a certain topic and learn any commands and more)
That's it. I wish us abundance, blessings, health, joy, wealth and happiness. Thanks to those who can lend a hand here♥.
submitted by daniel655422 to matlab [link] [comments]


2023.05.09 13:05 NoahWoelki Plot large dataset

Hello guys.
I have following setup:
My Python program generates output vectors of approx. 100k samples and three of them. So in total ~300k samples.
I have a python implementation to plot these, as well as a matlab implementation.
I want to include those plots into my Latex report. The important thing here is, that i want the fonts to match with the one in the latex document, and that the text (legend, labels etc.) are selectable in the PDF (e.g., for ctr+f searching).
I have tried some ways but everything either resulted in extremely long compiling time or pdflatex capacity violation.
I am happy about any suggestion for this specific case of the large dataset. I know there are ways (matlab2tikz, export as .eps, etc.,) but those are not really suitable for my case as i have tried them alerady, and the problems with memory and size have appeared.
submitted by NoahWoelki to LaTeX [link] [comments]


2023.04.30 22:28 ahsanansari100 discreet time coding help

discreet time coding help
Hi guys, im trying to code in matlab to create a discreet time code. I am trying to make it look like this (see picture) but it will have antiwindup and saturation. For some reason my output is oscillatory to my step input. I am a beginner in in discreet coding and I have coded in discreet so far please help:
Ts=0.23;
time=0:Ts:5;
Gp= tf([1.7 0],[1 5.06 0.71]);
Gpd= c2d(Gp,Ts,'tustin');
bode(Gp,Gpd);
b0=0.1229;
b1=0;
b2=-0.1229;
a0= 1;
a1=-1.245;
a2=0.2686;
Sat = 20;

% controller gains
Kp = 13;
Ki = 1.5;
Kd = 1;
AW = 0

% initialisation
u_c(1) = 0;
u_c(2) = 0;
y(1) = 0;
y(2) = 0;
ei(1) = 0;
ei(2) = 0;

for t=3:1:length(time) % loop to simulate the time
r(t) = 1; % generating the step input
e(t) = r(t)-y(t-1);
up(t) = Kp*e(t); % P term of PID
ei(t) = ei(t-1) + Ts*e(t); % error integration
ui(t) = Ki*ei(t); % I term of PID
ed(t) = 1/Ts*(e(t)-e(t-1));
ud(t) = Kd*ed(t);
if ui(t)>AW % if then rules to mimic saturation
ui(t)=AW;
elseif ui(t)<-AW
ui(t)=-AW;
else
ui(t)=AW;
end
u_c(t) = up(t) + ui(t); % control signal calculation
if u_c(t)>Sat % if then rules to mimic saturation
u_ac(t)=Sat;
elseif u_c(t)<-Sat
u_ac(t)=-Sat;
else
u_ac(t)=u_c(t);
end
% discrete time system implementation
y(t) = 1/a0*(-a1*y(t-1) - a2*y(t-2) + b0*u_ac(t) + b1*u_ac(t-1) + b2*u_ac(t-2));
ud(t)= -Kd*y(t)
end

% plot discrete-time setpoint and output
figure,
subplot(211)
plot(time,r,'r:',time,y,'b','linewidth',1.5)
ylabel('Output')
legend('r','y')
% plot the control signal

subplot(212)
plot(time,u_c,'r:',time,u_ac,'b','linewidth',1.5)
xlabel('Time(s)'), ylabel('Control signal'),legend('u_c','u_ac')

https://preview.redd.it/kopwp1vkz2xa1.jpg?width=533&format=pjpg&auto=webp&s=0e903017baedf8bd15705378834f6b8f6dda749e
https://preview.redd.it/c2fnkufjz2xa1.jpg?width=255&format=pjpg&auto=webp&s=0ad81a7bf857ef51b18299d67050600ca1e48ede
submitted by ahsanansari100 to matlab [link] [comments]


2023.04.30 08:29 Killer_insctinct Movie Ideas for SRK - My Take (TLDR Alert)

Chota muh badi baat or my hypothetical khicdhi. Ofc He will get 1000 more ideas and much better ideas than mine.
SRK is legend actor. And after Pathaan I was happy ki unka saalo ka sapna pura hua, Picture hit hui, Jo kuch bhi malicious unke khilaaf chal raha tha woh sab muh ke gr gaye. But man, that movie made me sad, so I thought of some ideas for SRK. They are below. Not because of Pathaan, but aise bhi main soch hi rha tha ki SRK koi retire nahi ho rahe aur rahege toh kaisi filmein karein jo abhi tak humne nahi dekhi unki taraf se. Aur chuki unki kaafi fans bhi kaafi grow aur mature ho gaye hai toh unke liye(Meaning 30+ ke liye) kya appealing ho sakta hai. I believe, this next phase will be taken away by him among all Khans, and I believe he is perfect to play all these roles.
1. Detective -
A well defined character(matlab detailing banane wale ko hi karni hogi) who is a Retired Policeman, or a policeman who is about to retire. I am not trying to go into Consultant role that hollywood often takes. Because we are land of comittees.
Inspirations can be taken from Byomkesh Bakshy, Sherlock, Poirrot, Benoit Blanc, all of these we have seen been adapted recently in hollywood.
Also, He can play Byomkeshi if it is not directed by Dibakar, I know you all are his major fans but his take was too darky aur woh time chala gaya. Yaha par ab uske upar me add karna hai. Or he can also reprise his previous iconic role of say Raju Gentleman(Not in continuity). Baadshah I think they already have bigger plans(main soch rha hu), isliye woh nahi bola.
The key thing in my take is that, it reflects the world that India is moving towards. In last 15 years, we have seen emergence of ultra rich in our country. And many instances we have seen first world imagery being presented.
However, this world is shown in some web series and movies already, this world has following three appeals.(IMO jo galat bhi ho sakti hai, Lower Middle Class POV Alert)
  1. It hooks in many people, people who may find characters relatable as much focus has been on first world problems(emotions) or be curious about how these people are and how they live. Many aspire to be rich and want to bring in that lifestyle in them.
  2. Some might find it so unrelatable that they kind of find ways to troll and have fun with it. You know ameero ki duniya types. We do not see any direct take on this, but in our cotunry satire and sarcasm is taken and content creators do milk Iphone people a lot. South Delhi Aunty gig are examples. But I do not suggest mockery or such skit type comic take.
IMO both are good points, to make a ultra rich world, and use it as a tool to present some critique, Villains can be people who just uses trends or make new jargons or innovation to raise funds and fools other Richs. We also see fake show off of richness to fool people into MLM.
Often we see stories about the poor, the common man, middle class man rising against the fooling of rich and powerful of the system and all. However, this would be showing of how rich fools those who aspire to be rich. Or how people are trapped into some ecosystem. These are things that happens, and are not much tapped into much yet. Art cinema may have tried it. But think of it, We have a sizeable population above poverty, Many have disposable income, and consumer spending has gone up, We now have a good luxury segment market. Aise mahaul me ye chiz click kar sakti hai but old approach se nahi jo humesha lete rehte hai.
Red Chillies production will give a different level of juicy punch to it I believe.
(Ye idea thora thora Knives our se copy kiya hai ok original nahi hai, but kahani nahi chepni hai, khaani ki themes refreshing hai)
2. Father role as a center in a family drama
I guess emotional people will eat it lie a cake. SRK can tell are story of a man who is coming out of rough middle age crisis raising teen kids. Or a man who is middle class in an ever chaning city, say GurGaon going from 2005-2012, Huliya badal gaya. And today that city is going through transition phase to be cosmopolitan aspirations. Aise badlaav me ek aadmi jiske bachche aashaye khub rakhte hai lekin uske paas means nahi hai. You know there was a thing about Ambani spending multi crore yet he spends 1% of his networth, but many in dekha dekhi takes laons.
But focus is on SRK and his kids, there can be 2, One maybe coming out of college, one going into. Divorce situ, or perhaps he is a man who never found love or he is that Rahul how fell in love but every girl ditched him. But he adopted kids with disability or issues. Or he himself goes through depression and anger issues or something which he overcomes on daily basis and becomes are father who is looked up on by his kids. What we need? someone who can teach us to tie a knot, on the go no?
My explanation is bad on this one.
(I am drawing a parallel with changing socio eeconomic situation too in our country and cities, not talking about rural much because A - sirf Melo Drama is meh for me, B - Cities and rural ka evolution me farak hai aur rural par bollywood ne bahut ghaseeta maara hua hai)
3. Scammer Role / Conman
Obvio is YT finfluencer or MLM or Pyramid scheme. Second could be some company or major financial scam. Which is pure scam. The movie needs to be made with juiciness and fast pace punch kyunki lecturebaazi me public bore ho jayegi as such concepts me waise hi kisi ko interest nahi hota. But Scam 92 is a good hint, I guess more juicy wirting can be made. Waise hi MLM wale bolne me ustaad hote hai khaaniya banae me ustaad hote hai. Wahi energy se movie me chalayege na toh bomb(movie plot me jo lehsun bomb hota hai woh) futne ka schock bhi utna hi zyada hoga.
4. A special role in an ensemble movie - agar koi raj comics ki ensmble movie banaye, toh usme dhasu wala role. Probably a Villain. Boss villain kyunki Bazigar hai woh. Waise har role unka special hi hota hai.
What roles you would like him to play in coming years?
submitted by Killer_insctinct to bollywood [link] [comments]


2023.04.07 04:54 RockingGoat Unlock the Secrets of Quantitative Trading: From Math to Market Mastery

Unlock the Secrets of Quantitative Trading: From Math to Market Mastery
Math and market mastery, who knew it was a winning combination? Well, Jim Simons did and he became a billionaire by using quantitative trading! Get ready to crack the code on the secrets of quant trading, from understanding the mathematical models to becoming the next ‘Quant King’ (or Queen) of Wall Street.
Quantitative trading, also known as quant trading, is a systematic approach to investing that uses statistical and mathematical models to analyze market data and execute trades. Unlike qualitative analysis that assesses opportunities based on subjective criteria, quant trading relies solely on data and models. It has become popular among financial institutions and hedge funds due to the high computing demands of the method, but recent advancements in technology have made it possible for individual traders to also engage in quant trading.
Quant trading works by evaluating the probability of a specific outcome using data-based strategies. Historical data, mathematical models, and programming are key components of the process. Traders may incorporate variables such as price and volume into their mathematical models and may also explore alternative datasets to discover present and potential trends.
https://preview.redd.it/xo9050pr4isa1.png?width=828&format=png&auto=webp&s=e863594ce2dbefd1c187fc8309532e66f1a18f65
Quant traders create automated software that is designed with mathematical models to identify patterns in historical data and make informed trading decisions. They may modify existing strategies or create their own. A background in mathematics, engineering, or financial modeling, as well as experience in computer programming and working with data feeds and APIs, is preferred for those seeking to work as quant traders.
Quantitative trading offers several advantages, including the ability to evaluate a wide range of markets using infinite data points, reduced bias in decision-making due to the absence of emotions, and increased efficiency with automated or semi-automated systems. However, quant trading also has its disadvantages, including the complexity of the method and the potential for models to be incorrect.
For example, after months and months forward testing, Candlelight’s Growth Rate is neck and neck with Buffett’s performance, decisions 100% made by machines, details: Two Years, 100+ Sets of Testing Results Confirm: Machines Can Beat Human Aces in Stock Market!
Quantitative stock trading is widely regarded as the next big thing in the trading world. This method of analysis has several advantages that make it a top choice for traders.
One of the biggest advantages of quantitative trading is scalability. Unlike traditional trading that uses only several analytical tools, quantitative trading can use an unlimited number of strategies and inputs, thanks to its use of high-performance computing. This means that even retail investors can use quantitative analysis to make informed investment decisions.
Quantitative trading also offers unlimited opportunities for diversification. This is because quantitative analysis can be used on any market, making it a suitable choice for traders who want to reduce risk by diversifying their portfolios. Additionally, the automated execution mechanism of quantitative trading allows traders to simultaneously operate multiple strategies.
Another benefit of quantitative trading is its accuracy. With statistical arbitrage, traders can rely on highly accurate data to make informed decisions. The use of algorithms and computers enables traders to make fast, precise decisions, which is especially important for high-frequency trading.
Quantitative trading is particularly useful for traders who want to diversify their portfolios, test various trading strategies, or operate in high-risk markets like cryptocurrencies. To make the most of quantitative trading, it is essential to have a deep understanding of market conditions, historical data, and available analysis methods.
Quantitative trading works by using mathematical analysis to create projection models that can be used to make informed trading decisions. To develop and configure the software, traders need to have programming skills, using languages such as C++, C#, MATLAB, R, Python, and VBA, etc.
In quantitative trading, a particular time interval is selected, and data is gathered and analyzed using algorithmic methods. This analysis is then used to make trading decisions based on the results. For example, if a share price rose from $12 at the opening of trading to $10.45 at noon, $14.78 at 12 PM, and fell to $9.35 after the close of intraday positions, a quantitative trader could analyze various parameters such as current time, current bid-ask prices, opening price, high/low price, current price direction, and MACD readings to make informed trading decisions.
There are many aces in quantitative trading area, one of the most famous masters is Jim Simons. He is a legend, known as the “Quant King”, and “The Man Who Solved the Market”, he is the founder of Renaissance Technologies and the Medallion Fund.
James Harris Simons is an American mathematician, hedge fund manager, and philanthropist who is best known as the founder of Renaissance Technologies, a quantitative hedge fund. With his remarkable success as an investor and hedge fund manager, Simons is widely considered as the “greatest investor on Wall Street” and “the most successful hedge fund manager of all time.”
Simons was born on April 25, 1938, in Brookline, Massachusetts. He received a Bachelor’s degree in Mathematics from MIT in 1958 and a PhD in Mathematics from UC Berkeley in 1961 at the age of 23. Throughout his academic and scientific career, Simons focused on the geometry and topology of manifolds, leading to numerous breakthroughs and advancements in the field. He was awarded the AMS Oswald Veblen Prize in Geometry in 1976 and was elected to the National Academy of Sciences of the USA in 2014.
Simons’ investment career began with the creation of Renaissance Technologies, a quantitative hedge fund that employs mathematical models and algorithms to analyze and execute trades. The main fund, Medallion, has been closed to outside investors since its inception in 1988 and has earned over $100 billion in trading profits, translating to an average gross annual return of 66.1% or a net annual return of 39.1%. In addition to Renaissance, Simons founded Math for America, a non-profit organization aimed at improving mathematics education in U.S. public schools.
Simons is also known for his philanthropy, particularly in supporting research in mathematics and fundamental sciences. He established the Simons Foundation with his wife and has been a trustee of the Simons Laufer Mathematical Sciences Institute at UC Berkeley since 1999. In 2016, the International Astronomical Union named asteroid 6618 Jimsimons after him in honor of his contributions to mathematics and philanthropy.
Qantitative trading is a cutting-edge method of investing that uses mathematical models and data analysis to make informed trades. Although it can be complex and challenging, it offers many advantages, including scalability, diversification, and accuracy. And if you happen to become a legendary quant trader like Jim Simons, you may even have an asteroid named after you! But remember, before embarking on your quant trading journey, it’s crucial to have a deep understanding of market conditions and a solid background in mathematics and computer programming. Happy trading!
submitted by RockingGoat to smartstocktraders [link] [comments]


2023.04.01 16:03 Mission_Ad8684 PSAT/MATLAB GUI error Reference to non-existent field

PSAT/MATLAB GUI error Reference to non-existent field
Hello everyone!
I am trying to use PSAT 2.1.11 with Matlab R2015b, when i export figures I got the following error:
Reference to non-existent field 'axesplot'. Error in fm_plot (line 484) axs_pos = get(Hdl.axesplot,'Position'); Error while evaluating UIControl Callback'' 
The problem is on the file fm_plot.m which is attached here fm_plot I have tried reinstalling PSAT and Matlab, but the error persists. I would appreciate any help you can provide.
See attached photo
https://preview.redd.it/q6l3jxb1iara1.png?width=580&format=png&auto=webp&s=3f7420e2c49031d3529e208a70c7c75bb0084d41
Thank you,
submitted by Mission_Ad8684 to matlab [link] [comments]


2023.03.25 17:55 Myusico Critique, please

Planning to be a quantitative analyst/developer.
https://preview.redd.it/l6pbvs511xpa1.png?width=1227&format=png&auto=webp&s=7bed8a44f04dd3ee9a340e8a9999fdece89baa97
submitted by Myusico to EngineeringResumes [link] [comments]


2023.03.23 21:36 Printedinusa Help with ode45 for a system of ODEs?

I'm very new to MATLAB and struggling a bit with a system of ODEs. While I've gotten my code to work just fine for only two ODEs, something seems to be going wrong for three or more. I'm getting an error that reads "@(T,Y)MYODE(T,Y,PARAMS) must return a column vector." If anyone could point out any obvious errors I'd be super appreciative.
code:
clc; clear; mu = -0.0001; alpha = 0.8; beta = 0.5; a = 0.1; b = 0.2; k = 0.5; m = 0.25; Dv = 0.7; Dh = 0.7; Qv = 1.0; Qh = 1.0; params = [mu; alpha; beta; a; b; k; m; Dv; Dh; Qv; Qh]; y0 = [0.3; 0.3; 0.1; 0.1; 1]; tspan = [0 50]; [t, y] = ode45(@(t,y)myODE(t,y,params), tspan, y0); subplot(2,1,1) plot(t,y) title('PredatoPrey Populations Over Time') xlabel('t') ylabel('Population') legend('Prey','Predators','Location','North') function dy = myODE(t,y,params) mu = params(1); alpha = params(2); beta = params(3); a = params(4); b = params(5); k = params(6); m = params(7); Dv = params(8); Dh = params(9); Qv = params(10); Qh = params(11); V1 = y(1); V2 = y(2); H1 = y(3); H2 = y(4); Vb = (V1 + V2) / 2; Hb = (H1 + H2) / 2; r = y(5); dy = zeros(5,4,3,2,1); dy(1) = r * V1 * (1 - (V1 / k)) * ((V1 - a) / k) - ((alpha * V1 * H1)/(V1 + b)) + Dv * (Qv * Vb - V1); dy(2) = r * V2 * (1 - (V2 / k)) * ((V2 - a) / k) - ((alpha * V2 * H2)/(V2 + b)) + Dv * (Qv * Vb - V2); dy(3) = beta * ((alpha * V1 * H1) / (V1 + b)) - (m * H1) + Dh * (Qh * Hb - H1); dy(4) = beta * ((alpha * V2 * H2) / (V2 + b)) - (m * H2) + Dh * (Qh * Hb - H2); dy(5) = mu; end 
errors:
Error using odearguments (line 93) @(T,Y)MYODE(T,Y,PARAMS) must return a column vector. Error in ode45 (line 106) odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin); Error in predatorprey (line 24) [t, y] = ode45(@(t,y)myODE(t,y,params), tspan, y0); 
submitted by Printedinusa to matlab [link] [comments]


2023.03.17 10:07 2IceeD Windows update broke anime matrix, any fix?

Windows update broke anime matrix, any fix? submitted by 2IceeD to ZephyrusG14 [link] [comments]


2023.03.02 23:06 RobGoesHam 2-in-1 Engineering/Gaming $1500 USD Limit

LAPTOP QUESTIONNAIRE
Bluetooth + Wi-Fi capabilities At least one HDMI port At least two USB ports but will settle for 1
MSI Summit and ASUS ROG are two that I’ve seen so far, but I’m open to all suggestions :)
Feel free to join our Discord server at: https://discordapp.com/invite/pes68JM for a faster response!
submitted by RobGoesHam to SuggestALaptop [link] [comments]


2023.02.21 23:18 DiamondMiserable226 Bandpass filtering EEG data, getting distortion

I am trying to bandpass filter an EEG signal, nothing fancy but it's coming out pretty distorted. EEG data is taken from forehead. Sampling rate is 250 Hz. Cutoff is 2.5 Hz & 120 Hz.
Tried in both matlab & python, getting same results.
Matlab code:
data = load("rawdata.mat");
data = data.data;
figure bandpass(data,[2.5 120],250)

https://preview.redd.it/b1l0x8dk9mja1.png?width=2908&format=png&auto=webp&s=4b3ff49e761de4bd9c229bd2b8ef8e470b1fd2ba

Here is the python code:
Fs = 250
lowcut = 2.5
highcut = 120
order=5
plotbutterworth(lowcut, highcut, Fs, order)
plt.figure()
fr, y_m = Fourier(250, data)
plt.stem(fr, y_m, use_line_collection = True)
plt.title('Freq CH7')
plt.xlabel("Frequency (Hz)")
plt.ylabel("Amplitude (microvolts)")
filtered = butter_bandpass_filter(data, lowcut, highcut, Fs, order)
plt.figure()
fr, y_m = Fourier(250, filtered)
plt.stem(fr, y_m, use_line_collection= True)
plt.title('Freq CH7 -- without EKG')
plt.xlabel("Frequency (Hz)")
plt.ylabel("Amplitude (microvolts)")
plt.figure()
plt.plot(data)
plt.plot(filtered)
plt.xlabel("Time")
plt.ylabel("Amplitude (microvolts)")
plt.legend(['original','filtered'],loc='best')


filter

fft

filtered fft

original & filtered
submitted by DiamondMiserable226 to neuro [link] [comments]


2023.02.21 23:16 DiamondMiserable226 Getting distortion issue trying to use simple bandpass filter

Getting distortion issue trying to use simple bandpass filter
UPDATE: Removing DC offset fixed distortion issue!

https://preview.redd.it/8vludcnxbnja1.png?width=397&format=png&auto=webp&s=dff293cc7c0810c5f0ed7b29a1d75c12c32ce284

I am trying to bandpass filter an EEG signal, nothing fancy but it's coming out pretty distorted. EEG data is taken from forehead. Sampling rate is 250 Hz. Cutoff is 2.5 Hz & 120 Hz.
Tried in both matlab & python, getting same results.
Matlab code:
data = load("rawdata.mat");
data = data.data;
figure bandpass(data,[2.5 120],250)

https://preview.redd.it/5vsgy3l49mja1.png?width=2908&format=png&auto=webp&s=9be9275b6acdbf649eb27dd020833004093012e3

Here is the python code:
Fs = 250
lowcut = 2.5
highcut = 120
order=5
plotbutterworth(lowcut, highcut, Fs, order)
plt.figure()
fr, y_m = Fourier(250, data)
plt.stem(fr, y_m, use_line_collection = True)
plt.title('Freq CH7')
plt.xlabel("Frequency (Hz)")
plt.ylabel("Amplitude (microvolts)")
filtered = butter_bandpass_filter(data, lowcut, highcut, Fs, order)
plt.figure()
fr, y_m = Fourier(250, filtered)
plt.stem(fr, y_m, use_line_collection= True)
plt.title('Freq CH7 -- without EKG')
plt.xlabel("Frequency (Hz)")
plt.ylabel("Amplitude (microvolts)")
plt.figure()
plt.plot(data)
plt.plot(filtered)
plt.xlabel("Time")
plt.ylabel("Amplitude (microvolts)")
plt.legend(['original','filtered'],loc='best')


filter

fft

filtered fft

filtered & original
submitted by DiamondMiserable226 to signalprocessing [link] [comments]


2023.02.21 23:13 DiamondMiserable226 Getting distortion issue trying to use simple bandpass filter

Getting distortion issue trying to use simple bandpass filter

UPDATE: Removing DC offset fixed distortion issue!
Here are the updates plots from Matlab and Python

Matlab Bandpass

fft of shifted data

fft of filtered shifted data

filtered data & original data in time domain

_____________________________________________________
I am trying to bandpass filter an EEG signal, nothing fancy but it's coming out pretty distorted. EEG data is taken from forehead. Sampling rate is 250 Hz. Cutoff is 2.5 Hz & 120 Hz.
Tried in both matlab & python, getting same results.
Matlab code:
data = load("rawdata.mat");
data = data.data;
figure bandpass(data,[2.5 120],250)


Matlab Plot
Here is the python code:
Fs = 250
lowcut = 2.5
highcut = 120
order=5
plotbutterworth(lowcut, highcut, Fs, order)
plt.figure()
fr, y_m = Fourier(250, data)
plt.stem(fr, y_m, use_line_collection = True)
plt.title('Freq CH7')
plt.xlabel("Frequency (Hz)")
plt.ylabel("Amplitude (microvolts)")
filtered = butter_bandpass_filter(data, lowcut, highcut, Fs, order)
plt.figure()
fr, y_m = Fourier(250, filtered)
plt.stem(fr, y_m, use_line_collection= True)
plt.title('Freq CH7 -- without EKG')
plt.xlabel("Frequency (Hz)")
plt.ylabel("Amplitude (microvolts)")
plt.figure()
plt.plot(data)
plt.plot(filtered)
plt.xlabel("Time")
plt.ylabel("Amplitude (microvolts)")
plt.legend(['original','filtered'],loc='best')


Filter

original data fft

filtered data fft

filtered data&original data
submitted by DiamondMiserable226 to DSP [link] [comments]


2023.02.21 02:23 yoonani First time buying a laptop. Already have a PC for high demand programs and gaming. Need laptop for school/work

LAPTOP QUESTIONNAIRE
submitted by yoonani to SuggestALaptop [link] [comments]