Skip to content

Instantly share code, notes, and snippets.

View sritasngh's full-sized avatar
😎

Sarita Singh sritasngh

😎
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<sbml level="3" version="1" xmlns="http://www.sbml.org/sbml/level3/version1/core">
<model extentUnits="mole" timeUnits="second">
<listOfUnitDefinitions>
<unitDefinition id="per_second">
<listOfUnits>
<unit kind="second" exponent="-1" scale="0" multiplier="1"/>
</listOfUnits>
</unitDefinition>
<unitDefinition id="litre_per_mole_second">
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
long long min_diff=10e7;
long long current_diff=0;
cin>>n;
vector<long long> arr(n);
for (int i=0;i<n;i++)
cin>>arr[i];
<?xml version="1.0" encoding="UTF-8"?>
<sbml level="3" version="1" xmlns="http://www.sbml.org/sbml/level3/version1/core">
<model extentUnits="mole" timeUnits="second">
<listOfUnitDefinitions>
<unitDefinition id="per_second">
<listOfUnits>
<unit kind="second" exponent="-1" scale="0" multiplier="1"/>
</listOfUnits>
</unitDefinition>
<unitDefinition id="litre_per_mole_second">
ios_base::sync_with_stdio(false); cin.tie(NULL);//used for fast input output
--scanf,printf is faster than cin,cout but we can use cin,cout and achive the same speed
//ios_base :: sync_with_stdio(false):It desynchronize all the C++ standard streams with their corresponding standard C streams
//cin.tie(NULL) :tie() is a method which simply guarantees the flushing of std::cout before std::cin accepts an input.
This is useful for interactive console programs which require the console to be updated constantly
but also slows down the program for large I/O. The NULL part just returns a NULL pointer.
@sritasngh
sritasngh / DSB-C_amplitude_modulation.m
Created July 21, 2020 13:21
Write a code in MATLAB to obtain output form the expression for the amplitude modulation (DSB-C) signals, where message signal is m(t)=5 sin(2 π 100t) and carrier signal c(t)= 10 sin(2 π 1500t).
%DSB-C modulation
Am=5; %amplitude of message signal
Ac=10; %amplitude of carrier wave
m_i=Am/Ac; %modulation index
fm=100; %frequency of message signal (Hz)
fc=1500; %frequency of carrier wave (Hz)
F=10000; %sampling frequency (Hz)
T=1/F;
t=0:T:0.05; %time vector
@sritasngh
sritasngh / hilbert_transform.m
Created July 19, 2020 13:52
Write a code in MATLAB to obtain Hilbert transform of the signal x(t)=5 cos(2 π 300t), obtain the analytic signal and plot its amplitude with time, and phase with time.
%Hilbert function
F = 10000; %sampling frequency(Hz)
t = 0:1/F:0.05; %time vector
x= 5*cos(2*pi*300*t); %given signal
x_h=hilbert(x); % Hilbert function of x(t)
figure(1);
plot(t,real(x_h),t,imag(y));
%Plot real and imaginary part of Hilbert function
xlabel('t(sec)'); ylabel('X_h(t)');
@sritasngh
sritasngh / frequency_modulation.m
Created July 19, 2020 13:50
Write a code in MATLAB for the Frequency modulation (FM) scheme where message m(t)= sin(2 π 10t) and carrier signal c(t)= 10 sin(2 π 1000t).
%FM modulation
Ac=10; %amplitude of carrier wave
fm=10; %frequency of message signal (Hz)
fc=1000; %carrier frequency (Hz)
F=10000; %sampling frequency (Hz)
kf=800; %frequency sensitivity
mi=kf/fm; % modulation index
T=1/F;
t=0:T:0.1;% time vector
@sritasngh
sritasngh / SSB-SC_modulation.m
Created July 19, 2020 13:48
Write a code in MATLAB for the single side band supressed carrier (SSB-SC) modulation scheme? Plot the spectrum (both lower and upper side bands) of the SSB-SC signal if message signal m(t)=5 cos(2 π 200t) and carrier signal c(t)= 10 cos(2 π 2000t).
%SSB-SC modulation
Am=5; %amplitude of message signal
Ac=10; %amplitude of carrier wave
fm=200; % frequency of message signal (Hz)
fc=10*fm; %frequency of carrier wave (Hz)
F=10000; %sampling frequency (Hz)
T=1/F;
t=0:T:0.025; %time vector
%1.Message signal
@sritasngh
sritasngh / amplitude_modulation.m
Created July 19, 2020 13:46
Write a code in MATLAB to obtain output form the expression for the amplitude modulation (DSB-C) signals, where message signal is m(t)=5 sin(2 π 100t) and carrier signal c(t)= 10 sin(2 π 1500t).
%DSB-SC modulation
Am=5; %amplitude of message signal
Ac=5; %amplitude of carrier wave
fm=100; %frequency of message signal(Hz)
fc=1500; %frequency of carrier wave (Hz)
F=10000; %sampling frequency (Hz)
T=1/F;
t=0:T:0.1; %time vector
%1.Message signal
// Interfacing Arduino with DHT11 humidity and temperature sensor
// include LCD library code
#include <LiquidCrystal.h>
// include DHT library code
#include "DHT.h"
#define DHTPIN 8 // DHT11 data pin is connected to Arduino pin 8
// LCD module connections (RS, E, D4, D5, D6, D7)
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
#define DHTTYPE DHT11 // DHT11 sensor is used
DHT dht(DHTPIN, DHTTYPE); // Initialize DHT library