text stringlengths 8 6.12M |
|---|
%exam4-3
%f16-14
w = input("angular velocity of arm in rad/s: ");
r = input("length of arm AB in m: ");
l = input("length of rod BC in m: ");
Vb = w * r;
sprintf("angular velocity is %.3f", Vb / l)
|
function [out1] = czy_pierwsza_f3(x)
if x<=1 %sprawdzenie czy wprowdzona jest liczba ujemna lub rowna 1
out1 = "Liczba mniejsza od 2";
return;
end
for i=2:x-1 %petla wykonujaca sie x-1 razy
if mod(x,i)==0 %sprawdzenie czy reszta z dzielenia x przez i jest rowna 0
out1 = "Zlozona";
... |
[X,Y] = meshgrid(0:1:100);
%Z =(100*X.^2 +X.*Y.^2).*(1-sigmf(Y,[.1 100]));
%Z = 10*(sigmf(X,[1 10])+sigmf(X,[1 20])+sigmf(X,[1 30])+sigmf(X,[1 40])+sigmf(X,[1 50])+sigmf(X,[1 60])+sigmf(X,[1 70])+sigmf(X,[1 80])+sigmf(X,[1 90])).*(sigmf(Y,[1 10])+sigmf(Y,[1 20])+sigmf(Y,[1 30])+sigmf(Y,[1 40])+sigmf(Y,[1 50])+sigmf(Y,[... |
function varargout = iqChnl(varargin)
% run this function to calibrate iq channels
%
% iqChnl('awgName',_c_,'chnlSet',_c_,'maxSbFreq',_f_,'sbFreqStep',_f_...
% 'loFreqStart',_f_,'loFreqStop',_f_,'loFreqStep',_f_,'spcAvgNum',<_i_>,...
% 'notes',<_c_>,'gui',<_b_>,'save',<_b_>);
% awgName: name o... |
%% Initialization and reading dataset
% dividing randomly to test and train
test_P = 0.20; %97
[m,n] = size(fts) ;
idx = randperm(m);
K = max(labels); % determining number of classes [1-K]
%% read files to fts and labels variables (or just click on your dataset in matlab files)
%% ML running
FPRs=[]... |
# Author: Valentin Andrei
# E-Mail: am_valentin@yahoo.com
function [c_speech, v_n_frames_speech, n_speakers] = build_speech_input ...
( v_directories, fs, frame_ms, frame_inc_ms, max_speakers = 0)
% ----------------------------------------------------------------------------
% Input:
% ---------------------... |
% Shai Knight-Winnig 2018
%FIRST MOMENT CONDITION FUNCTION: Returns a 2x1 vector (since z has 2 instruments)
%{
This function takes imported data and builds moment conditions
to reflect the sample analogue of the theoretical moment condition
from equation 9 in paper (Berry and Waldfogel 1999). ... |
%num_train = 2;
%num_test = 2;
%irun = 9; % run train index (1...20)
%irun_other = 1; %run test index (1....20)
runs_to_fit = [1:20];
train_row = [1:20]; % training item index (1...20)
test_row = [1:20];
%itest = [18,19]; % test item index (1...20)
|
load gt/005304.mat
% trans_ind = [1,2,3,4,10,6,7,14,9,8,12,13,11,14,15];
% t_SDAHIP.clustering{1} = t_SDAHIP.clustering{1}(trans_ind, :);
% t_SDAHIP.clustering{2} = t_SDAHIP.clustering{2}(trans_ind);
% gt_g(gt_g > 0.33) = 1;
% imshow(gt_g, []);
result_t = im2double(result);
result_t = resizem(result_t, size(gt_g));
r... |
%%% Takes values as parameters. NOT arrays.
%%% Calculates the values of the Expected price value of the asian call
%%% option and the delta of the expected value for the geometric asian call
%%% option
function [geometric_asian_expected_asian, geometric_asian_expected_delta] = geometricAsianExpected(S0,K,sigma,r... |
function [extremum, is_maximum] = parabolicInterp(x1, x2, x3, y1, y2, y3)
% parabolicInterp computes parabolic interpolation extremum given three 2D
% points.
% is_maximum: 0 if extremum is minimum, 1 if extremum is maximum
%
% check to see if the three points are collinear
triangleArea = x1 * (y2 - y3) + x2 ... |
function [track_out,track_line] = tracking_step_4_2(dis_range, angle_range, x1,y1,x2,y2,x3,y3, track_out,track_line,point_candidate,track_line_new,image_number)
%% 追踪算法分步调试:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% step 4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 寻找 x1 和 x2 相互之间都有多个匹配点的信息
while length(x1)
point_num = 1;
x =... |
function [] = repref_showInstructions_phase1(window,imageLocs,colors,keys,cbhand,fMRI,stims,outputFile)
%% parameters
% number of practice trials
PRAC_BLOCKS = 2;
PRAC_TRIALS_BLOCK = 5;
% timeing variables
T_TARGET = 1;
T_DELAY = 7;
T_TRIAL_DURATION = T_TARGET+T_DELAY;
% timing stuff
fl... |
function flyTracks = turnTriggeredAverage(flyTracks)
winsz = 100; % size of window
param = 'orientation';
for k = 1:flyTracks.nFlies
tturn = flyTracks.turns(k).all; % get the times of each turn
ct = 0;
clear tta
for i =1:length(tturn)
try
% Line below must be alt... |
function [sys_def,sys_prop,sys_abs,sys_opt] = vanderpol1()
% System description string
sys_def.str = 'vanderpol1';
%% System description
sys_def.SIM = @SIM;
sys_def.modeInvMap = getModeInvMap();
sys_prop.initConstraints = initConstraints();
sys_prop.finalConstraints = finalConstraints();
% # of state vars to the sys... |
function nmatNew=getTimingData(midifile, times)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% nmat=getTimingData(midifile, times)
%
% Description: Create a note matrix with performance timings
%
% Inputs:
% midifile - name of midifile
% times - note onset and offset times
%
% Outputs:
%... |
% begin
% init a, η(*), b, k = 0
% do k=(k+1) mod n
% Yk = {}
% j = 0
% do j = j+1
% if at yj <= b then append yj to Yk
% until j = n
% a = a + η(k) ΣyЄY ((b-aty).y) / |y|2
% until Yk = {}
% return a
% end
% classes
class1 = [1 6; 7 2; 8 9; 9 9; 4 8; 8 5];
class2 = [2 1; 3 3; 2 4; 7 1; 1 3; 5 2];
%class1 = [1 7; ... |
% analyze 3AFC SAM noise, OSCOR
clear all
subjects = {'BM'};
All_Accuracy = [];
figure, hold on
for subjs = 1:numel(subjects)
load([subjects{subjs} '_randAMvsIAC.mat'])
uFMs = unique(FMs);
Accuracy = [];
for i = 1:length(uFMs)
ThisCondition = FMs == uFMs(i);
CondAcc = sum(corr... |
clear;
load('Large_keyframes_cluster.mat');
ncluster = size(C,1);
histcnt = histcounts(idx,ncluster);
[sortedX,I] = sort(histcnt,'descend');
flag = zeros(ncluster,1);
for i=1:floor(0.1*length(I))
flag(I(i)) = 1;
end
histcnt = histcounts(idx,ncluster);
[sortedX,I] = sort(histcnt,'ascend');
for i=1:floor(0.05*... |
%% Prepare the image
PrepareImage;
%% Determine using Random number gerenrator or not
%if(0) not use
%else Using the Random number with this seed
UsingSeed = 5;
%% The string need to be inserted
string = 'Done El7amdo llah';
fprintf('The string you want to insert is ''%s'' \n\n',string);
%% Insert th... |
function sphered_data=cchengData_Sphering(HIM)
%% Code Comments:
% For information about data_sphering see README
%
% There is one parameter, data_sphering(HIM) where the HIM is the
% Hyperspectral image cube, which is a 3-D data matrix
% [XX,YY,bnd] = size(HIM), XX YY are the image size,
% bnd is the band number of th... |
%This function performs PCA using .nc files for a all timesteps in sw and
%lw paths focusing on the WAVELENGTH_HRES and RADIANCE_HRES_CLR variables
%for the longwave, and the WAVELENGTH_LRES, RADIANCE_LRES_CLR,
%RADIANCE_LRES_ALL, and SOLAR_FLUX variables for the shortwave. Only the 6
%most dominant principle componen... |
function task = generate_trials_opto(n_trials)
n_trials_per_sess = 500;
% Pre-allocate
task.new_sess = zeros(n_trials, 1);
task.rightprobs = zeros(n_trials, 1);
task.leftprobs = zeros(n_trials, 1);
task.stim_type = zeros(n_trials, 1);
for trial_i = 1:n_trials
% Should this be the first trial in a new session?
... |
% echoEffects.m
% Dan Hirlinger
% 2/1/2021
clc; clear;
% input signal
[x,Fs] = audioread('AcGtr.wav');
% Delay
%
% delayMS = 150;
% delaySec = delayMS / 1000;
% BPM
BPM = 90;
BPS = BPM / 60;
delaySec = 1 / BPS;
d = round(Fs * delaySec);
% Delay using zero-padding
w = [zeros(d,1) ; x];
% Make "x" same length as "... |
function QX = lec18applyQ(QR,tau,X)
[m,n] = size(QR);
QX = X;
for j = n:-1:1
w = [1; QR(j+1:end,j)];
QX(j:end,:) = QX(j:end,:)-(tau(j)*w)*(w’*QX(j:end,:));
end
function QTX = lec18applyQT(QR,tau,X)
[m,n] = size(QR);
QTX = X;
for j = 1:n
w = [1; QR(j+1:end,j)];
QTX(j:end,:) = QTX(j:end,:)-(tau(j)*w)*(w’*QT... |
size(eye(2, 3)) |
function [ ] = waitBar( time )
%WAITBAR 延时器
% 延迟时间 time ms
h=waitbar(0,'Loading...');
n=1;
for i=1:time;
waitbar(i/time)
n=n+i;
end
close(h)
end
|
clear all
figure(1), clf; FS = 18;
for i = 1:4
[D,T] = xlsread('Datasets.xlsx');
%% These are the variables we're changing for the decision problem.
% How many years has the population been observed for?
if i == 1; Obs = 15;
elseif i == 2; Obs = 8;
elseif i == 3; Obs = 9;
elsei... |
function fftSignal = signalFFT(rawData)
% input radarSignal is a 3-D signal
% compute fft to graph it in the figure
% using chebishelv window function
windowData = repmat(chebwin(size(rawData, 1), 60) * chebwin(size(rawData, 2), 60)' , 1, 1, size(rawData, 3));
radarData = rawData .* windowData;
% fft for 3-D si... |
% =========================================================================
%> @section INTRO IsDry
%>
%> - 가장 낮은 셀의 이웃 셀의 flood 상태를 확인하여, 1) 유향이 정의되어 있거나
%> 또는 SINK인 경우 true를 반환하고, 2) 현재 처리 중인 flooded region인 경우
%> false를 반환하는 함수
%> - 3) 위의 조건도 아니라면 OLD_FLOODED에 해당하는 경우인데, 이 경우도
%> 가장 낮은 셀이 유출구가 될 수 있으므... |
function [ Q, kara ] = kosztSzybki(zd, param, var, rho)
% szybkie wyliczanie wskaznika jakosci
x = zeros(1,5);
us = zeros(2,1);
u = zd(3:end);
t = 0;
x(1) = param.rE * cos(zd(1));
x(2) = param.rE * sin(zd(1));
x(3) = - (param.VE + zd(2)) * sin(zd(1));
x(4) = (param.VE + zd(2)) * cos(zd(1));
x(5) = param.m0 * exp(para... |
function criterion = feature_criterion(x,y)
index_0 = find(y==0);
index_1 = find(y==1);
x_0 = x(index_0,:);
y_0 = y(index_0,:);
x_1 = x(index_1,:);
y_1 = y(index_1,:);
cvp_0 = cvpartition(y_0, 'Holdout', 0.25);
cvp_1 = cvpartition(y_1, 'Holdout', 0.25);
xtrain =... |
function [LnfX,errest] = pdint(n,xyrange,funct,X,varargin)
%-------------------------------------------------------------------------------
% USAGE of "pdint".
%
% [LnfX,errest] = pdint(n,xyrange,funct,X)
% [LnfX,errest] = pdint(n,xyrange,funct,X1,X2)
% [LnfX,errest] = pdint(n,xyrange,funct,X,[],opt1,opt2,...)
% [LnfX... |
clear all
clc
h = 10;
[~,~,~,rho] = atmosisa(h);
global inteference % 0: 无干扰 1: 只有上对下干扰(直接相加) 2:上下相互干扰(拟合数据)
%% 建立对象
global DoubleRotorHelicopter
global LowerRotor UpperRotor
global Prop
% 直升机
DoubleRotorHelicopter = Helicopter();
DoubleRotorHelicopter.GW = 5500;
DoubleRotorHelicopter.GWF = 5500*9.81;
% ... |
function chamber_est(pattern, verbosity)
% chamber_est(pattern, verbosity)
% verbosity values combine bitwise
% verbosity 1 draws the temperature plot identifying cool and uncool
% regions
% verbosity 2 shows each fit for chamber scatter
% verbosity 4 draws the final figure showing chamber scatter and raw counts
... |
function test_Poly()
a = [1 1.5 2.5];
x = 77;
% test poly code 1
val1 = p1(x)
% test poly code 2
val2 = p2( a(1), a(2), a(3), x)
% test poly code 3
val3 = p3(a, x)
% vector of x-Values
xVec = -3:0.2:4.5;
length(xVec)
size(xVec)
% try putting vector into input for p3
% val_Vec = p3(a,xVec)
for i=1:length(xVec)
... |
classdef bayesFactor < handle
% A class to perform Bayes Factor statistical analysis to quantify
% evidence in favor or against a hypothesis.
% For background see
% "Rouder, J. N., Speckman, P. L., Sun, D., Morey, R. D., & Iverson, G. (2009). Bayesian t tests for accepting and rejecting the null hypothe... |
function ratios = reldiff_all(folder_targ, folder_ref, common, time_span)
% obtain all ratios of parameters between model results in folder1 relative
% to model results in folder2
cd(folder_targ)
load(['results/Niter=' num2str(common.Niter) ', Ndt=' num2str(common.Ndt) '_target_predictions/result.mat']);
cd ..
pars_f... |
%Function that calculates the state of the robot in the current frams.
%Outputs a structure RobotFrame with the following values
% - S: Motion space of joint, stacked for each joint
% - i_X_pi: Spatial transformation from parent frame to body frame, stacked for each joint
% - pi_X_i: Spatial transformat... |
function [F, dF, fluxRampStrobe] = decodeData(file,swapFdF)
% digitizerFrequencyMHz/numberSubBands
subBandHalfWidthMHz=4.8;
% if swapFdF =0 then f stream first, df second
% if swapFdF=1 then f stream second, dF stream first
if nargin < 2
swapFdF = 0
end
if swapFdF == 0
nF = 1; nDF =2;
else
nF=2; nDF=1;
... |
function [rci, cci, minobj, rec] = icc(mat, nrc, ncc, varargin)
% ICC Bregman co-clustering algorithm using I divergence.
%
% [rci, cci, minobj] = icc(mat, nrc, ncc, [[argID,] value, ...])
%
% Examples:
% [rci, cci] = icc(mat, nrc, ncc)
% [rci, cci, minobj] = ecc(mat, nrc, ncc)
%
% INPUT:
% mat (matrix) 2-D matrix... |
function [stats] = scale_data(stats, constant)
% calculate actual particle diameter and add to stats
for i=1:length(stats)
stats(i).d_p = constant*stats(i).d_e; % actual diameter
end
|
% extract the envelopes
WAV_path = './WAV/*.wav';
file_list = dir(WAV_path);
for i = 1:length(file_list),
[y,Fs] = wavread(['./WAV/' file_list(i).name]);
env(i).signal = envelope(y, Fs);
if Fs == 44100,
env(i).signal = resample(env(i).signal,10, 441);
else
en... |
classdef ActivationFunction
enumeration
TLU,
Sign, %Not implemented
Linear,
Piece_wise_linear, % Not implemented
Sigmoid,
Hyperbolic % Not implemented
end
end
|
clc;clear all;
markers = ["lef","lbd","lelb","lelb1","lps","lie","lie1","ref","rbd","relb","relb1","rps","rie","rie1"];
addpath('F:\github\wearable-jacket\matlab\WISE_KNT')
% addpath('C:\Users\fabio\github\wearable-jacket\matlab\WISE_KNT') % fabio address
cd(strcat('F:\github\wearable-jacket\matlab\kinect+imudata\'));
... |
function [ixdot, iydot] = integrate_xy(state, tf, VR, p)
N = size(state); N = N(1);
ixdot = 0; iydot = 0;
[~,x] = fourierdiff(N);
V = state(:,1);
chi = state(:,2);
gamma = state(:,3);
z = state(:,4);
t = tf*x/(2*pi);
h = t(2)-t(1);
for i = 1:N-1
Wx1 = VR*(-z(i))^p; Wx2 = ... |
function []=circulo(radio,posx,posy,color)
y_c=radio*cos([0:10:360]*pi/180)+posy;
x_c=radio*sin([0:10:360]*pi/180)+posx;
plot(x_c,y_c);
fill(x_c,y_c,color);
axis([-15 15 -15 15]);
axis('square');
end |
function parameters = set_parameters(depth_image)
% function parameters = set_parameters(depth_image)
ft = imread('face_shoulders.gif');
if ((max(depth_image(:)) >= 256) & (size(depth_image, 1) == 480))
parameters.face_template = ft;
parameters.hand_score_threshold = 120;
parameters.extra_depth = 100;... |
% Author: Fabio Henrique (oliveirafhm@gmail.com)
% 04/2018
% DR parameters correlation analysis
%% Load data
% Load parameter settings xls
%%
corrData_sammons = sammons;
% Pick only columns to be correlated
varsColumns = {'Iter';'LR';'DRErr';'CVAcc'};
corrDataSTable = array2table(corrData_sammons,...
'VariableNa... |
clear all
tic
%% Extract Raw Data
filepath = 'C:\Users\mpanagi\Documents\GitHub\Marios-temp\MP012\RawData\';
filename = 'MP_LPCD_1Lever_Degraded_Day7';
%FilepathSurfacePro
% filepath = 'C:\Users\Marios\Documents\GitHub\Marios-temp\MP012\RawData\';
%FilePathTinsleyPC
%filepath = 'C:\Users\mpanagi\Documents\GitHub\Mari... |
function plot_signal_2D_maps(varargin)
% Vstupné argumenty:
% CLEAN = Časová tabuľka čistých údajov.
% INTERVAL = Dĺžka jednej vzorky údajov v minútach.
% DATE = Pole začiatočného dátumu a času. Prvý numerický údaj
% predstavuje deň, druhý údaj predstavuje mesiac, tretí
% hod... |
% EJERCICIOS RESUELTOS DE VISIÓN POR COMPUTADOR
% Autores: Gonzalo Pajares y Jesús Manuel de la Cruz
% Copyright RA-MA, 2007
% Ejercicio 3.4: Transformaciones geométricas
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 3.7.2 Transformaciones elementales
%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
function matrix = matrixDesign_3var(x1_max,x1_min,x2_max,x2_min,x3_max,x3_min,a)
c1 = x1_max - abs(x1_max - x1_min)/2;
c2 = x2_max - abs(x2_max - x2_min)/2;
c3 = x3_max - abs(x3_max - x3_min)/2;
matrix = [x1_min x2_min x3_min;
x1_min x2_min x3_max;
x1_min x2_max x3_min;
x1_min x2_... |
% gnss & totalstation
pkg load signal
format long
% -----------------------------------------------------
% load gnss data from file
fin = fopen('gnss.txt');
log = fscanf(fin, '%f %f %f %d:%d:%d', [6 inf])';
fclose(fin);
% change H:M:S to secs
t_gnss = log(:,4) * 3600 + log(:,5) * 60 + log(:,6);
h_gnss = log(:,3);
% --... |
function [mass,bus] = RBES_mass_budget
% global params
r = global_jess_engine();
%% Run mass budget RBES
r.eval('(focus MASS-BUDGET)');
r.run;
[~,values] = my_jess_query('MANIFEST::Mission','satellite-mass#',false);
mass = values{1};
mass = str2double(char(mass));
[~,values] = my_jess_query('MANIFEST::Mission','standar... |
function AnalysisResult2d( obj )
%ANALYSISRESULT Summary of this function goes here
% Detailed explanation goes here
OutstepNum = obj.outputFile.outputStep;
% analysis 2D water level results
cellId2 = [ 1, 6, 11, 20 ];
nodeId2 = [ 1, 1, 1, 2 ];
ind2 = sub2ind( [obj.mesh2d.cell.Np, obj.mesh2d.K], nodeId2, cellId2 );... |
function [data, hdr] = read_img(h, name)
% [data, hdr] = read_img(h, name)
% or
% [data, hdr] = read_img(name)
%
%
% Luis hernandez
% last edit 10-24-2008
%
% Loads the data from an analyze format file 'name' containing mutislice image data
% if the file contains multiple TIME points,
% this function returns... |
function output = WaveletFilter(input,...
waveletName,...
decompositionLevel,...
alpha,...
keepApprox,...
hardThreshold)
temp = zeros(1,length(input));
i... |
clc
clear
close all
I1=imread('lena.png');
kernel2=imread('mb-kernel.png');
% I1=reshape(I1,[numel(I1),1]);
sd=0.5;
sn=10;
L=1.5;
k_size=ceil(6*sd+1);
if rem(k_size,2)==0
k_size=k_size+1;
end
kernel = zeros(k_size,k_size);
kernel1=kernelfunc(sd);
kernel_sum2=sum(sum(kernel2));
kernel2=double(kernel2)./kernel_su... |
clear classes;clear variables;close all;clc;
% Add FIRM toolbox and external toolboxes as needed to the Matlab path
addpath(genpath(pwd))
add_external_toolboxes()
% Parameters
user_data = user_data_class; % The object user_data will never be used. This line only cause the "Constant" properties of the "user_dat... |
% SPAA final assignment
% Rui Oliveira, 2020
%% Configs
close all;
clear all;
% Simulation parameters
n = 10; % Order of NLMS
mu = 0.7; % Adaptation step
lambda = 0.99; % Error filter parameter
T = 10000; % Number of points
sigma = 0.01; % Error power
epsi = 1e-300; % Divison by zero protection
%% Initialization
% ... |
% Script that extracts position of fibers inside certain volume control
clc
clear all
close all
folder_name = uigetdir; % Select the folder that contains the output folder
% The data below was pulled from Moldex3D
filePath=[folder_name '\output\Positions_0010.txt'];
fileName=fopen(filePath);
f_bound = 15;... |
clear
clc
addpath('C:\Users\wdh130\Documents\NO-Modeling-Data\Vasomotion')
addpath('C:\Users\wdh130\Documents\NO-Modeling-Data\Vasomotion\WGN_NO_production')
f_name = {
'5NO_0NOd_1NOsens_50bGC_1500Hz_20VD_6sNOkernel_GammaWith1Hgb_45_Hct_RawGamma_dynamic_v24.csv',
'5NO_0NOd_3NOsens_50bGC_1500Hz_20VD_6sNOke... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Title: tof_picker
% Description: several kinds of TOF pickers
% Author: Xiaolei Qu
% Date: 2014.06.13
% Version: 1.0
%... |
function [Psi1,Psi2,Psi3,n11,n12,n13,n22,n23,n33,nTOF11,nTOF12,nTOF13,nTOF22,nTOF23,nTOF33,x,y,z]=...
getPsisInterspaced(filename_Psis,filename_SysParams,...
intersp_x,intersp_y,intersp_z,Hedgehogize)
% Returns order parameter values Psi1 and Psi2 stored by the GPE solver
% i... |
fs = 8192; % this is the sample rate
r = audiorecorder(fs, 16, 1); % create an audiorecorder object
recordblocking(r, 10); % record for 2 seconds
p = play(r); % listen to recording to verify
y_r = double(getaudiodata(r, 'int16'));
save funky_modem_rx.mat y_r x_sync Fs msg_length |
function iods = dicom_iods
%DICOM_IODS Repository of information object definitions.
% IODS = DICOM_IODS returns a structure array containing various DICOM
% information object definitions (IODS), which are used to create
% Service-Object Pair (SOP) classes. SOP instances comprise the high-
% level descr... |
% v107p_mcc.m
% This function extracts a single tree-ring time series from
% ringwidth_import.m and places it in a vector for time series analysis.
% The function power transforms and removes the mean to create transformed
% residuals. The function then detrends with an iterative neg. exponential
% fit, or if th... |
function [x,f,exitflag,output] = minFuncTR(funObj,x0,options,varargin)
% solver can be: cauchy,steihaug,dogleg,schur,Linf
% cgSolve:
% 0: use analytic Hessian in steihaug
% 1: use Hv products
% Tunable parameters
[verbose,verboseI,maxIter,optTol,eta1,eta2,gamma1,gamma2,solver,Hessian,cgSolve,...
HvFunc,useComp... |
addpath([pwd,'/controller/cp/Jojos_EML_files']);
addpath([pwd,'/controller/cp/step_planning_interface']);
|
function Sys = AssembWPHB(Sys)
if ~isfield(Sys,'nnWP')
Sys.nnWP = 1:Sys.NDOFs*Sys.nHarms;
remId = [];
for ibc=1:length(Sys.Dir)
remId = [remId; Sys.Dir{ibc}];
end
for ibc=1:length(Sys.WP)
for jh=1:Sys.nHarms
remId = [remId; Sys.WP{ibc}+Sys.NDOFs*(jh-1)];
... |
% Model structure 1: Original Model
% This model assumes no microbe-microbe interactions and simply that each
% bacteria is internalizing MNZ.
function dy = Original_2sp_ode(t, y, params)
neq = size(y,1);
dy = zeros(neq,1);
LB = y(1);
GV = y(2);
MNZext = y(3);
MNZint_lb = y(4);
MNZint_gv = y(5);
MET = y(6);
b1 = p... |
function [ V ] = BilinearInterp( X , Y, Img )
V=0;
p = size(Img,1);
q = size(Img,2);
f_x=floor(X);
f_y=floor(Y);
c_x=f_x + 1;
c_y=f_y + 1;
if (f_x >=1 && f_y>=1 && f_x <=p && f_y<=q)
V = V + Img(f_x,f_y)*(c_x-X)*(c_y-Y);
end
if (c_x >=1 && f_y>=1 && c_x <=p && f_y<=q)
V = V+ Img(c_x,f_y)*(X-f_x)... |
% DEMOGRADIENTDESCENT compute a gradient descent for an initial position
% and an end position of a human body
%you can modify the error value to make the channels get closer to the
%wanted channels
error = 10;
step = 0.01;
skel = acclaimReadSkel('07.asf');
[channels, skel] = acclaimLoadChannels('07_01.amc', sk... |
function Evolving_Policy_Parametrization
%
% Author: Petar Kormushev
%
close all;
%% Parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nbData = 200;
% Target unknown goal function to be appoximated using spline tuned by RL
target.ax = 0:0.01:1;
target.ay = 0.5 + 0.2*si... |
function center = sym_correct(image,center,windowsize)
% input: image - gaussian distributed matrix, center - approximate center
% coordinates, windowsize - size of the region that is scoped
% output: center - corrected center coordinates
% initialize optional parameters
if isempty('center') || ~exist('center','... |
parpool('local',32)
p=gcp();
n=size(train,1);
%A={};
%A=distributed(A);
%parfor i=200:264
% A=rankgenA(i,train,X);
%end
%delete(gcp)
%p = gcp();
% To request multiple evaluations, use a loop.
for idx = 1:n
f(idx) = parfeval(p,@rankgenAnew,2,idx,train,X); % Square size determined by idx
end
% Collect the results as ... |
FOV = 0.2 ; % m
MYDIM=40;
xres = FOV/MYDIM; % m
gamma = 267.5 * 1e2 % rad/s/Gauss
Tmax = 0.005; %s
dt = 1/(125e3) ; % s
Kmax = 1/(2*xres);
deltaK = 1/FOV; % resolution of k-space (separation between turns)
Ntheta = 2*Kmax/deltaK; % N. turns of the in in-plane spiral required for critical sampling in radial dir... |
cc()
% trunk = '/Volumes/murthy/jan/courtship/dat/141202_1137/141202_1137';%'dat/140827_1329/140827_1329';
trunk = '/Volumes/murthy/jan/courtship/dat/140728_1732/140728_1732';%'dat/140827_1329/140827_1329';
load([trunk '_res']);
fp.vr = VideoReader([trunk '.mp4']);
fp.tracks = p.tracks;
fp.orientation = p.orientation;
... |
function judge_tag = judge_currentFrame(img, current_shape, Classifier,classifier_params)
PS = Classifier.PS;
svmModel = Classifier.svmModel;
tmp = local_descriptors(img, current_shape, classifier_params, 3);
Testing_data = tmp(:)';
Testing_data = mapminmax('apply',Testing_data',PS);
Testing_data = Testing... |
close all;
clear;
ToDeg = 180/pi;
ToRad = pi/180;
L1=50;
L2=100;
L3=100;
th1=180;
th2=0;
th3=0;
DHfk3Dof_Lnya(th1,th2,th3,0);
view(134,12);
pause;
DHfk3Dof_Lnya(th1,th2,th3,1);
stp=15;
num=1;
stp=pi/12;
oth1=0;
oth2=0;
oth3=0;
r=100;
for i=0:stp:2*pi
x(num)=60+r*cos(i);
y(num)=60+r*sin(i);
z(num)=80;
... |
close all, clear all,
N=1000; n = 2; K=10;
% mu(:,1) = [-1;0]; mu(:,2) = [1;0];
% Sigma(:,:,1) = [2 0;0 1]; Sigma(:,:,2) = [1 0;0 4];
p = [0.35,0.65]; % class priors for labels 0 and 1 respectively
% Generate samples
% label = rand(N,1) >= p(1); l = 2*(label-0.5);
% Nc = [length(find(label==0)),length(find(label==1))];... |
function [out]=job_del(id,opt)
% (id,opt), opt=0:delete dir&file, opt=1:remove dir only. opt=2: remove
% files only.
name0='/home/swlee/';
for jj=1:1:length(id)
name1=sprintf('Job%d',id(jj));
if(opt==1)
rmdir([name0, name1],'s');
end
if(opt==0)
delete([name0, name1, '*.*']);
rm... |
Data = OpenNarayan(6);
MaximumArray = zeros(64,1);
DataAutocor = Data;
Scale = 2;
AutocorBool = 1;
if AutocorBool==1
for i=1:64
DataAutocor(:,i) = AutocorHM(Data(:,i))';
plot(Data(:,1));
plot(DataAutocor(1:end-100));
DataFT = abs(fft(DataAutocor(:,1)));
DataFT = DataFT(1:fl... |
clear all;
close all;
clc;
a=imread('cew5.jpg');
b=double(a);
figure; imshow(a);
c=medfilt2(b);
d=medfilt2(c);
figure; imshow(c/255);
figure; imshow(d/255);
e=imread('cew5_2.jpg');
f=double(e);
figure; imshow(e);
N1=240;
N2=320;
p=0;
m=zeros(240,320);
for i=1:N1
for j=1:N2
m(i,j)=... |
function A_pt = generate_epipolar_eqs_real(p1, p2, third_proj, pt_shift, u, is_direct, is_stereoshift)
%t=alpha*u - R * pt_shift
%t_x R p = alpha* u_x R p - R * (pt_shift_x p)
inds = [1 2 3; 4 5 6; 7 8 9];
t2 = [1;0;0];
if (~is_direct)
inds = inds';
end
if (length(third_proj) == 2)
... |
for i = 0:9
for j = 1:10
x(i+1,j) = i * 10 + j;
endfor
endfor
x |
%% How much orientation tuning do voxels have?
% Subj 3, top twenty voxels in V1 with best betase
whichVoxs = [509,198,181,83,97,183,353,82,339,359,318,327,317,302,308,319,188,834,297,40];
[imNumsToUse, betamnToUse, voxNums] = loadDataset(3, whichVoxs);
% Just the ori stimuli
catToUse = {'grating_ori'};
load(fullfile... |
% Loading the test image and displaying its content
test_image_1 = imread('./images/TPTest1.png');
test_image_2 = imread('./images/TPTest2.png');
test_image_3 = imread('./images/TPTest3.png');
% Displaying the test images
imshow(test_image_1);
imshow(test_image_2);
imshow(test_image_3);
% Extracting the shape feature... |
% Reports convergence progress
function Y = convergence_report(adjtype,finegrid,MMiter,sizeofMMgrid,pDIFF,piter,VDIFF,Viter,PdistDIFF,Pdistiter)
clc
disp(sprintf('Model : %d',adjtype))
disp(sprintf('Fine grid : %d',finegrid))
if ~isempty(MMiter)
disp(sprintf('MM iter : %d of %d',[MMiter, sizeofMMgrid]... |
% % Based off of code from
% % https://nirmalthapa.wordpress.com/2012/06/03/multiclass-svm/
% % http://www.mathworks.com/help/stats/svmtrain.html
% % http://www.mathworks.com/help/stats/svmclassify.html
clear
s_train_datasets = {'ATNTFaceImages400','HandWrittenLetters'};
s_test_datasets = {'ATNT50','ATNT200'};
... |
function [deltaVarIntuitive, deltaVarPerturbed] = computeVariabilityAlongBCIMappings(beforeLearningClouds,afterLearningClouds,B,Bpert)
% Modified from deltaVariance_mainTextFigureHelper.m
%
% @ Matt Golub, 2018.
intuitiveMapping.LI_varBreakdown = computePartitionedVariance([beforeLearningClouds.factorActivity{:}],B);
... |
function [] = ADP_Motion_Correction3(inFolder, outFolder, rigid)
if(nargin<3)
rigid = true;
end
fprintf('\nFolder %s\n',inFolder);
% outFolder = strrep(inFolder,'RawData','MotionCorrected');
fprintf('\nLoading...');
[Y, Yred] = makeStacks3(inFolder, 10);
fprintf('Do... |
function [X_estimate,t_b_estimate,length_estimate]=TPMBM_all_estimate1(filter_upd,existence_estimation_threshold,Nx)
%Author: Angel F. Garcia Fernandez
%Option 1: one picks global hypothesis with highest weight and then takes the
%trajectory Bernoullis above a certain threshold
%Then, for each Bernoulli, we estimat... |
clc;
clear all;
% 实际矩阵 z(x,y)的 下标定义,下标含小数
x=1.1:0.1:1.5;
y=3.1:0.1:3.5;
[x_new,y_new]=meshgrid(x,y);
z=zeros(5,5);
% 构造矩阵 z(a,b),下标为整型
for a=1:1:5
for b=1:1:5
z(a,b)=exp(x(a)+y(b));
end
end
% 画图
mesh(x,y,z)
% % ---------------------
% % 作者:图像小白
% % 来源:CSDN
% % 原文:https://blog.csdn.net/Zz501306162... |
% Compute the total degree, in-degree and out-degree of a graph based on
% the adjacency matrix; should produce weighted degrees, if the input matrix is weighted
% INPUTS: adjacency matrix
% OUTPUTS: degree, indegree and outdegree sequences
% GB, Last Updated: October 2, 2009
function [deg,indeg,outdeg]=degrees(adj)
... |
function fitness = distance_metric(state, target)
% Note to me: state specified as [x; y; vx; vy]
% target specified as [x; y; ux; uy]
% Distance metric calculation: Calculate desired vantage point as -1 units
% in the desired direction from the target location.
c = target(1:2,:) + target(3:4,:);
fi... |
function printmodel(m)
%PRINTMODEL(m)
% Prints model and fit statistics output from regstats
fprintf('Beta coefficients for linear model:\n');
fprintf(' i beta\n');
fprintf(' %10.6f\n',m.beta);
% M: stats array
fprintf('\n');
fprintf('Regression coefficent t-test with dfe = %8.2f\n... |
classdef gaussianNoiseLayer < nnet.layer.Layer
% gaussianNoiseLayer Gaussian noise layer
% A Gaussian noise layer adds random Gaussian noise to the input.
%
% To create a Gaussian noise layer, use
% layer = gaussianNoiseLayer(sigma, name)
properties
% Standard deviation.
... |
function eu = test()
global emiu;
disp(emiu);
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.