text stringlengths 8 6.12M |
|---|
% twoStimuli
% randomStimuli(stimuliNum, stimuliSize, ISI, clr, itr)
% plot number (stimuliNum ) of rectangles in random postions of size
% stimuliSize. Repeaet this itr time with ISI between them
% example:
% randomStimuli(10, 3, 5, 100, 100, 500, 255, 5, [500 400 700
% 800],'test1.txt')
debugOn = 1;
try
% If th... |
function [x, A, f, Z1, Z2,CostF, CostZ1, CostZ2] = CloudFogOptimization(CloudCost,CapCloud,FogCost,CapFog,Task, NTask, NC, NF, alfa,alfa2)
%% ------- Create the Cost Function function -------
f = [reshape(shiftdim(CloudCost*Task([1:4],:),1),[],1);reshape(shiftdim(FogCost*Task([1:4],:),1),[],1)]; % length NC*NF*... |
%%%%This script concatenate scan.s ID and dominic from Daniel, then with wisc-hand file, anfinally with test_combi_scanfirdom_scrub.csv
% read csv
csv_id_scan= niak_read_csv_cell('/home/yassinebha/Dropbox/twins_study/twins_data/behavioral_data_yassine/Data_combine/Correspondance_Scans_Jumeaux_daniel.csv' );
csv_id_dom... |
%--------------------------------------------------------------
% Elektrische Systeme 1
% Musterlösung - Aufgabe 15
% Prof. Dr.-Ing. V. Sommer, Beuth Hochschule für Technik Berlin
%--------------------------------------------------------------
clear
close all
home
% Vorgabe der Widerstände und Spannungen:
... |
function attenuation = vegetation_attenuation(distance, specific_attenuation, maximum_attenuation)
%% Calculate the attenuation due to vegetation.
% :param distance: The distance into the vegetation (meters).
% :param specific_attenuation: The specific attenuation of the vegetation (dB/km).
% :param maximum_attenuation... |
function [ gd ] = momentum_gradient_descent( L, varargin )
%MOMENTUM_GRADIENT_DESCENT Initializes an momentum-based gradient descent.
p = inputParser;
addRequired(p, 'L', @iscell);
addParameter(p, 'learning_rate', 0.1);
addParameter(p, 'momentum', 0.01);
parse(p, L, varargin{:});
eta... |
% Authors - Basaran, Baumberger, Dietsch, Wert
function [x,y] = next_pos2(angle_est,v,prev_pos)
% Computes the next position from the estimated angle_est in radians, the time and the
% previous position prev_posd
dt = 1;
prev_pos_x = prev_pos(1);
prev_pos_y = prev_pos(2);
angle_in_rad = angle_est;... |
function plotActualStructuralResponse(fact,probabilityInfo)
% Hugo Esquivel, 2021
% -
numRandomVariables=length(probabilityInfo.name);
if numRandomVariables==2
fact=matlabFunction(fact);
numPoints=50;
s=getProbabilitySupports_Plot(probabilityInfo);
x1=linspace(s(1,1),s(1,2),numPoints);
... |
close all;
clear;
imgs_folder = 'images2';
img_rgb=dir(fullfile(imgs_folder,'*.png'));
img_depth=dir(fullfile(imgs_folder,'*.mat'));
img_rgbname={img_rgb.name};
img_depthname={img_depth.name};
rgb=natsortfiles(img_rgbname);
depth=natsortfiles(img_depthname);
imgseq1=repmat(struct('rgb',fullfile(imgs_folder,img_rgb(1)... |
% qp_balmer.m
% Ian Cooper
% School of Physics, University of Sydney
% https://d-arora.github.io/Doing-Physics-With-Matlab/
% Plot of the line spectrum for the Balmer series
%%
clear all
close all
clc
c = 3e8;
G = 6.67e-11;
NA = 6.02e23;
k = 1.38e-23;
e = 1.602e-19;
sigma = 5.67e-8;
u0 = 4*pi*1e-7;
h = 6.625e-34;
hP... |
function newDoE = MCInterProjTh(numpnts,oldDoE)
%This function finds new DoE locations to sample frun
% numpnts is the number of points to return
% oldDoE are the old DoE points
%This algoirhtm is based off of Crombecq et al. 2011
%"Efficient space-filling and non-collapsing sequential design strategies
%for simu... |
function [ value] = interploateFieldStrengthForDistance( fieldStrengths, distance, antennaHeightIndex)
%interploateFieldStrengthForDistance Step 4: Determine the lower and higher nominal distances from Table 1
% closest to the required distance. If the required distance coincides with
% a value in Table 1, this sho... |
function errors = pac_eegapp(EEG,channels,window_length,numberOfBin,LFO_bp,HFO_bp)
% pac_eegapp calculate phase amplitude coupling.
% errors = pac_eegapp(EEG,channels,window_length,numberOfBin,LFO_bp,HFO_bp)
%
% Input:
% EEG = eeg structure file coming from eeglab
% channels = a vector containing all channe... |
% WorkingP='\\fmri-t9\users\Moran\DCE\DCE_Duration\001_HAVLIN_HAIM_MORDECHAY\Study20140831_120511_day224_T4\DCE_38min\HaMo_20140831\';
% AIFP='\\fmri-t9\users\Moran\DCE_Duration\01_HAVLIN_HAIM_MORDECHAY_3\Study20141019_100533\DCE\DCE6-3\HaMo_20141019\';
AIFP='\\fmri-t9\users\Moran\DCE_Duration\ParamsForParkerAIF\';
%% ... |
function stopTracking(s)
% Yipeng Hu - 2012-2014
%% start tracking
reply = [];
while isempty(reply) || ~strcmpi(reply(1:2),'OK'),
fprintf(s,'TSTOP ');
reply = fscanf(s,'%c');
end
fprintf('igitkNDIPolaris:Tracking stopped.\n\n'); |
skelin = '~/Downloads/annotation.xml';
skelout = '~/Downloads/annotation_out.xml';
p = struct;
p.ds_ratio = [3 3 1];
p.use_radii = true;
p.experiment = 'K0057_D31';
tic; [minnodes, rngnodes] = knossos_downsample(skelin,skelout,p); toc
|
clear; clc; ca;
bend_arr = 0:20:80;
n_bend = length(bend_arr);
n_pks = 20;
m_dist = 5; % minimal distance required to keep points (when removing overlaps)
y_lim = [0,450]; % figure y-limin (pixels)
dname_arr = {'20SDR-H_30_0003','20SDR-H_30_0021','20SDR-H_30_0067','20SDR-H_30_0083','20SDR-H_30_0099'}; %
% r_range = ... |
% addpath('../meshpart');warning off;
clear; clc; close all; rng(0);
[a, b] = deal(-1, 1);
m = 256; % number of subintervals per dimension
f = 0*5e8; % if f = 0 then Helmholtz -> Poisson
ndoms = 256;
nbasis = 4;
fem_type = 0; % choose 0 for triangles or 1 for squares
if ( fem_type )
[h, ne, n, coo,... |
function [ImageOut] = X_Space2D_Demo(ImageIn,PlottingOn,SaveVid,varargin)
%% Introduction
% This function is a demonstration of the working principles behind X-Space
% Magnetic Particle Imaging (MPI). It makes a number of assumptions to
% simplify the system to make it easier to read and therefore learn from.
% Namely... |
function varargout = BlockEdfSpectralSummarizeFig(varargin)
% BLOCKEDFSPECTRALSUMMARIZEFIG MATLAB code for BlockEdfSpectralSummarizeFig.fig
% BLOCKEDFSPECTRALSUMMARIZEFIG, by itself, creates a new BLOCKEDFSPECTRALSUMMARIZEFIG or raises the existing
% singleton*.
%
% H = BLOCKEDFSPECTRALSUMMARIZEFIG retur... |
clearvars; close all;
%select all the matvelocity figures
[fnames,pname] = uigetfile('*mat','Open AVI files','MultiSelect','On');
filenameforexcel='C:\Users\Lenovo\Documents\both patients_updated2.21.19 -findendsac.xlsx';
[num,text,raw]=xlsread(filenameforexcel,1);
ids=num(:,1);
agecollumn=6;
mscollumn=2;
v... |
%
% Author: Vincent Guigues.
%
% File : generate_polygone.m
%
% Purpose : Generates a nonintersecting polyhedron with at most N vertices
% points are generated randomly with distances of the vertices
% to the origin having uniform distribution on the interval [0,R]
% [Poly... |
function Tinv=invtrans(T)
Rinv=T(1:3,1:3)';
Tinv=[Rinv,-Rinv*T(1:3,4)
zeros(1,3) 1];
end
|
function varargout = drawDome(varargin)
%DRAWDOME Draw a dome (half-sphere, semi-sphere) as a mesh.
%
% drawDome(DOME)
% Where DOME = [XC YC ZC R], draw the dome centered on the point with
% coordinates [XC YC ZC] and with radius R, using a quad mesh.
%
% drawDome(Dome, V)
% Where DOME = [XC YC ZC R] and V i... |
Kp=30
Ki=100
cntr=tf([Kp,Ki],[1,0]);
sys_ctrl=feedback(cntr*plant,1)
m=1
b=10
k=20
num=1
den=[m,b,k]
plant=tf(num,den)
sys_ctrl=feedback(cntr*plant,1)
t=0:0.01:2
step(sys_ctrl,t) |
function PL=PL_logdist_or_norm1(ht,hr,d,d0,n,sigma)
%对数距离或对数阴影衰落路径损耗的两径模型
%输入
% ht:发射天线的有效高度
% hr:接收天线的有效高度
% d:发射机和接收机之间的距离[m]
% d0:参考距离[m]
% n:路径损耗指数
% sigma:方差[dB]
%输出
% PL:路径损耗[dB]
PL=-20*log10((ht*hr)./(d.*d))+10*n*log10(d/d0);%式(1.4)
if nargin>5
PL=PL+sigma*randn(size(d));%式(... |
function [] = graficaPolLagrange(f, Xvector)
[r, c] = size(Xvector);
if r~=1 && c~=1
error('dimensión Xvector incorrecta');
end
n = length(Xvector);
Yvector = f(Xvector); % f tiene que servir para vectores
if(Xvector(n) < Xvector(1))
auxV = Xvector(n):0.1:Xvector(1);
else
... |
function run = copse_reloaded_bergman2004_expts(basemodel, expt, comparedata)
% COPSE reloaded experiments
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%% run control
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
run = paleo_run;
run.config = 'c... |
clc;
clear all;
[data,txt,raw] = xlsread('EnergyUS.xlsx');%load all data
NYSE = data(:,2); %load NYSE data
M = data(:,3:end);%all stocks
VarNames = {txt{3:end}};%get the names of the stocks
alpha = 0.05; %significance level
[AdjR2tot AdjR2step bstep]=MyRegress(NYSE,M,alpha,0,VarNames);
fprintf('The stepwise fit co... |
% crop Crop data to a region of interest
%
% This method crop PDV data to a time range of interest.
% object=crop(object,[tmin tmax]);
% object=crop(object); % interative cropping
% By default, interactive cropping displays the measured signal for
% zooming/panning. Interactive cropping can also be performed usi... |
%function tool_add_HOV_lane()
% Assumes old schema (Network Editor v20)
clear
close all
addpath([pwd filesep '../utils/xml_io_tools_2007_07'])
addpath([pwd filesep '../utils'])
original = [pwd filesep 'newI80_6.xml'];
outfile = [pwd filesep 'newI80_withHOV.xml'];
% read node list and directions cache
disp('Reading... |
function runCN0andRinex(gnssFile, rinexFile)
fileFolder = strsplit(gnssFile, '\');
fileFolder = strjoin({fileFolder{1:end-1}},"/");
gnss_data = reader(gnssFile);
gnss_initial_time = gnss_data.initial_time;
rinex_data = readerRinex(rinexFile);
sessionName = strcat("session");
plotCN0andRinex(gnss_initial_time,gnss_dat... |
function [ psx ] = findPS( filename )
% load energy file
energy = importdata(filename);
% isolate t=0.1 --> t=1
[row,col] = find(0.1 < energy(:,1) & energy(:,1) < 1.0);
E = energy(row(:),:);
clear row col
% set x & y vars
x = E(:,1);
y = E(:,4);
% reduce x & y
xn=x(1:2:end);
yn=y(1:2:end);
% calculate derivative
... |
function covOut=rearrangeCovarianceMat(covOrig,nodeIDoutRect)
% covOrig = n x n covariance matrix
% nodeIDOutRect = n x 1 vector, contains ones for nodes in region and zeros
% elsewhere
% covOut = p x p covariance matrix, where p is the number of nodes in the
% selected reg... |
function [g, gp] = ReLU(x)
%RELU Semi-linear activation function
% g - max(0, x)
% gp - heaviside(x)
gp = x > 0;
g = x;
g(~gp) = 0;
end
|
%Write netcdf files for all uptake data underlying manuscript figures for data deposition.
%The basis is tslice files from LPJ-GUESS which give means over the years 2001-2014.
%
%Dependencies: write_netcdf_lpjg.m
%
%T. Pugh
%26.04.19
addpath('/data/Disturbance/netcdf_conversion_scripts')
input_dir='/media/pughtam/rds... |
function color_rgb = cornsilk
color_rgb = {'color', [1.0, 0.97254, 0.86274]};
end |
function CodeLE(bitDepth,gamma,RefL,minL,maxL)
% Program for computing the number of code values according to
% given max luminance(maxL) and min luminance(minL)
% Plot two curves (PQ and gamma) in the [minL, maxL]
% Input:
% bitDepth: the dit depth of code values
% gamma: gamma values in gamma OETF
% RefL: the ... |
% Read the semantic descriptors xls file
%%
load('data')
sub_ids = (1:9); % Total number of subjects.
num_cmd = numel(size(modifier_data, 1)); % 34
num_sd = numel(sd_names); % 67
if ~exist('data_final','var')
X = zeros(num_cmd, num_sd, numel(sub_ids));
for idx = 1 : numel(sub_ids)
sub_idx = sub_ids(i... |
addpath '/Users/Prashikh/Desktop/Fall 2020/ECE 4560/Homework/rvctools'
clear all
close all
clc
startup_rvc
% Plotting the contour
x = linspace(-10,10,1000);
y = linspace(-10,10,1000);
dt = 0.13;
[X,Y] = meshgrid(x,y);
Z = (X+2).^2+(Y).^2;
contour (X,Y,Z,200)
colorbar
grid on
hold on
r0 = [-2,0]';
r1 = [3,1]';
% Cre... |
clear all ; close all ;
cd c:/shared/lastute/valerie
mask = load_untouch_nii('fnirt/ute_mask.nii.gz') ;
resute = load_untouch_nii('res_ute.nii.gz') ;
l = load_untouch_nii('layers.nii.gz') ;
maskim = pad3d(mask.img > 0,10) ;
layerim = pad3d(l.img,10) ;
layerim(layerim==0) = nan ;
layerim = max(max(max(la... |
function[db, mag, pha, w] = freqs_m(b, a, wmax)
w = [0:1:500]*wmax/500;
H = freqs(b, a, w);
mag = abs(H);
db = 20 * log10((mag + eps)/max(mag));
pha = angle(H); |
a = 0.95;
b = 0.5;
nx = 5000;
x = sin(pi/2*linspace(-1,1,nx+2)); x(1) = []; x(end)=[];
gam0 = 3; gam1 = 4;
Lambda = -2*a./(1+a-b).*(gam0 + 2*(1-b)/(2+a-b)*gam1);
gam = @(xVar) gam0*weight(xVar,a,-b) + gam1*weight(xVar,a,1-b) + Lambda*weight(xVar,a-1,-b);
plot(x,gam(x));
lift = quadgk(gam,-1,1)
ylim([-5,5]) |
function pf_th=profile_thresholding_new(pf,th)
pf_th=cell(1,6);
row_size=size(pf,1);
if length([pf{:,1}])==0
row_size=0;
end
if row_size~=0
for i=1:row_size
if length(pf_th{1,1})~=0
index_temp=size(pf_th,1)+1;
else
index_temp=1;
end
... |
function p=eq_pelev(P,alfa,tl,Hz,dc2corr);
%p=eq_pelev
%
%p=eq_pelev(P,alfa,tl,Hz,dc2corr)
%Calculates elevation pressure drop for all nodes
gz = set_gz;
j1 = get_dc2nodes;
gz(j1) = gz(j1)*dc2corr;
Tsat = cor_tsat(P);
Rol = cor_rol(P,tl);
Rog = cor_rog(Tsat);
Rom = alfa.*Rog + (1-alfa).*Rol;
p = gz.*Rom.*Hz;
|
function out = RDF(BW,h)
% Given a black and white image and the point C (i,j) from which to calculate
% RDF... generate vector 'out' with step size h.
% Radii can only be tested up to the size of mask that will fit in the
% image.
[ih iw] = size(BW);
out = zeros(round(ih/h),1);
r = 0;
C = find(BW(:)==1); ... |
function psi = w(m, phi)
% w creates w states with relative phases
%
% in:
% m: number of qubits
% phi (optional, default = 0): array of relative phases
% out:
% psi: psi(:,j) is the state (basis00...01 + sum(exp(i*phi(j))) of the rest of basis states) / sqrt(m)
% in the tensor product basis
if nargin < 2
p... |
clearvars; clc; close all;
Record = importRecord('Record.txt');
figure;hold on;
plot3(Record.EX, Record.EY, Record.EZ, 'linewidth', 2);
plot3(Record.SX, Record.SY, Record.SZ, 'r', 'linewidth', 2); |
function noise = noise_generator(maximo, tiempo, fs)
% noise = noise_generator(maximo, tiempo, fs)
% Genera ruido segun una frecuencia de muestreo
%
% tiempo: Medido en segundos
% fs: Frecuencia de muestreo
% p: Potencia del ruido en dB
% maximo: Valor maximo del ruido
noise = wgn(fs*tiem... |
function codeword = encoder(gen1, gen2, dataword)
%disp(dataword);
len_dataword = length(dataword);
generator_matrix = zeros(len_dataword, length(gen1) + 2*(len_dataword - 1));
j = 1; % number of positions to leave, before proceeding to fill gen_values
i = 1; % row index in generator_matrix
p = 1; % ... |
function UpdateUI( hObject )
% Update all GUI elements.
data = guidata(hObject);
fields = fieldnames(data);
for i=1:length(fields)
if (isa(data.(fields{i}), 'matlab.ui.control.UIControl'))
init_uicontrol(data.(fields{i}));
end
end
|
% showRawView.m
%
% Sets magnetoPreview.m's displayMode to RawView.
%
% JSB 11/2010
function showRawView()
global trackingParams;
trackingParams.displayMode = 0; |
function W_new = pi_(RA,W)
global Parameter
% BLOCKING STATES ARE MARKED AS SUCH
counter = 1;
W_new{counter} = [];
for i=1:length(RA.S)
if RA.zeno{i}==1 %skip checking all s since they can't occur (zeno avoidance)
for j=1:length(RA.Delta{i})
if ~strcmp(RA.Delta{i}{j},'blocking') && sum(strcmp(RA... |
function [y, fs, bits] = record_w_matlab(time_in_seconds)
desired_rec_freq = 16e3;
recObj = audiorecorder(desired_rec_freq, 16, 1);
disp('Start speaking.');
recordblocking(recObj, time_in_seconds);
disp('End of Recording.');
y = getaudiodata(recObj);
fs = recObj.SampleRate;
bits = recObj.BitsPerSample;
end |
A = [ 0 10 20 30 40 50 60 70 80 90 100 ];
recieved_power_sorted = sort(A,'descend')
N_devices = length(recieved_power_sorted);
M_devices = 4;
I_1 = zeros(N_devices,1);
I_2 = zeros(N_devices,1);
I = zeros(N_devices,1);
p=0.9;
for i= 1:M_devices
for j = 1 : M_devices
if(i == j... |
function rmse = rmse(y,y_pred)
% Compute RMSE for regression problem
m = length(y);
mse = (1/m) * sum((y-y_pred).^2);
rmse = sqrt(mse);
end
|
% Visualization of labels
load labelPredict.mat
load win.mat
testImage = imread('image_5.jpg');
totalPoints = length(labelPredict);
imshow(testImage)
hold on;
for index = 1:totalPoints
xDim = floor(win(index,2)); % Column
yDim = floor(win(index,1)); % Row
if (labelPredict(index,1) == -1)
plot(xDim,y... |
function entropy = calcEntropy(Y)
G = hist(Y(:),1:256);figure;bar(G);
pixels = sum(G); % sums pixels to find total number
entropy = 0;
for r = 1:256
prob = G(r)/pixels;
if(prob ~= 0)
entropy = entropy - prob.*log2(prob);
end
end
end
|
% Lab 5 prelab: Two-op amp oscillator circuit. Transient analysis.
addpath('/usr/local/CppSim/CppSimShared/HspiceToolbox');
clear variables;
hspc_filename = 'ECE214_Lab5_prelab.hspc';
hspc_addline('.tran 10u 125m 25m', hspc_filename);
ngsim(hspc_filename); % run NGspice
% load simulation results and extract time, Vo... |
%% Written By Twan Burg %%
% Obtained from MATLAB File Exchange %
% As input give the values for all 2^n-1 coalitions in lexicographic order.
% The file ComputingShapleyvalue.m makes use of the 2 other files. So enter
% after v=[ your game. For example, when a game consists of 3 players, v=[0
% 1 2 3 4 3 9] means v(a)... |
classdef TofInputFunction < handle & mlaif.MMRFung2013
%% TOFINPUTFUNCTION retains the methodology of mlraichle.Fung2013, but replaces data from the
% cervical carotid artery with data from TOF MRA.
% $Revision$
% was created 22-Nov-2021 20:34:42 by jjlee,
% last modified $LastChangedDate$ and placed int... |
function fcns = outputProcessingFcns(net)
% Copyright 2012-2015 The MathWorks, Inc.
fcns = {};
for i=1:net.numLayers
if net.outputConnect(i)
fcns = [fcns net.outputs{i}.processFcns];
end
end
fcns = unique(fcns);
|
function mml2edm_onoff(Directory)
%MML2EDM_ONOFF -
DirStart = pwd;
if nargin < 1
if ispc
cd \\Als-filer\physbase\hlc\Devel
else
cd /home/als/physbase/hlc/Devel
end
else
cd(Directory);
end
% 8 10 12 14 18 24 72
FontSize = 14;
RowLabelWidth = 50;
%/home/als/physbase/hlc/Devel
BMWidth... |
function lda_trainer = lda_training(trainData, trainLabel)
% use LDA to train data
% input : trainData - attributes set of examples
% trainLabel - label of examples
% output : lda_trainer - struction of center and eigenvector
% -----------------------------------------------------------------------
... |
clear all
close all
% Create an instance of a seeker:
aSeeker = Seeker; |
function x = mywt(b)
p0= length(b);
for i=1:p0
x(i)=norm(b(i,:))^(-0.5);
end
|
function[Ga]=dynamicmodel_old(tfinal,fi,fd,a,h,c)
i=1;
k=1;
x=0.01;
K_process=1.2;
sigma=0.56;
colorstring='bgr';
fo(i)=K_process*h(i);
%noise = fi(i) + sigma*randn(size(sin(t_f(i))));
%%____________________fi model_____________________________________________
while k<3
%while k<2
if (k==1) ||(k>1 && fd(... |
function status = XuFindOffCenter(s_jsonc)
mkdir('temp');
para=XuReadJsonc(s_jsonc);
para.OutputDir='temp_recon';
para.InputFiles='Water_.*.raw';
para.HammingFilter=0;
mkdir(para.OutputDir);
for off_center_distance=13.01:0.1:14.01
para.SliceCount=1;
para.DetectorOffcenter=off_center_distance;
para.Output... |
for ss = [1 2 3 4]
u_THAL_SMA(ss,tt) = ((o_GPi_SMA(ss,tt)));
a_THAL_SMA(ss,tt) = (decay_constant)*a_THAL_SMA(ss,tt - 1) + (1 - decay_constant)*u_THAL_SMA(ss,tt - 1);
o_THAL_SMA(ss,tt) = - W_THAL*sigmf(a_THAL_SMA(ss,tt), [alpha_thal beta_thal]);
end
|
function [ac,Taus] = autocorr(f,varargin)
[sizes{1:nargin-1}]=size(varargin{1});
t=cell(1,nargin-1);
for i=1:nargin-1
ind=prod(cell2mat(sizes(1:i-1)));
Ts = varargin{i}(ind+1)-varargin{i}(1);
Rng = max(varargin{i}(:))-min(varargin{i}(:));
t{i} = -Rng:Ts:Rng;
end
if nargin==2 % 1D
ac ... |
function lns = text2lines(text,w)
lns = {};
i1 = 1;
i2 = w;
while length(text) > w
i2 = min(w,length(text));
lns = [lns {text(i1:i2)}];
text = text(i2+1:end);
end
i2 = min(w,length(text));
lns = [lns {text(i1:i2)}];
return
end
|
%-----------------------%
% Código pergunta 6 %
%-----------------------%
close all
clc
clear
samples=[0:499];
x=sin(0.22*samples);
snrs{1,7} = [];
snrsIdeal{1,7} = [];
Ns = {2,3,4,5,6,7,8};
figure
for i=1:length(Ns)
sinalQuantizado = quantiza(x,Ns{i});
sinalRuido = sinalQuantizado-x;
snrs{i} = snr... |
function nps = power_law_noise(P, varargin)
% nps = power_law_noise(P(alpha, beta), f1, f2, ..., fn)
% nps = power_law_noise(P(alpha, beta), fr)
%
% Returns a radially symmetric power-law NPS, nps = alpha * fr^(-beta), for
% Cartesian or radial input coordinates.
%
% f1, f2, ..., fn are equally sized n-dimensi... |
function warni(varargin)
% Format-proof warning function with verbose option
% This function just warn anything, even numbers.
% You can also just provide all the message parts separated by commas rather
% that producing a string between brackets.
% If warni is provided with an argument 'verboseOFF' then it just tells... |
% test grid deformation
% primary mirror
PM=struct();
PM.label = 'PM';
PM.position = [0,0,0];
PM.direction= [0,0,1];
PM.cuy = 0; %flat
PM.K = 0;
PM.type = 1; % 0=reference, 1=reflect, 2=refract
PM.diameter = 100; %1m
PM.local = [1 0 0; 0 1 0];
PM.n = 1.0;
screen = struct();
screen.position=[0 0 100];
... |
%%
addpath(genpath('../aux/'))
addpath(genpath('../kalman/'))
addpath(genpath('../data/'))
addpath(genpath('../sPCA/'))
addpath(genpath('../../robustCov/'))
%%
clear all
%% Load real data:
load ../data/dynamicsData.mat
addpath(genpath('./fun/'))
% Some pre-proc
B=nanmean(allDataEMG{1}(end-45:end-5,:,:)); %Baseline: las... |
function mflpscc(ui1,ui2,ui3,ui4,ui5)
% Whether to re-scale pulse
val1 = get(ui1,'Value') ;
if val1 == 1 ;
set(ui1, 'BackGroundColor', 'White') ;
set(ui2, 'Visible','on','BackGroundColor', 'White') ;
set(ui4, 'BackGroundColor',[0.501961 0.501961 0.501961]);
set(ui5, 'BackGroundColor',[0.501961 0.501961 0.501961]);
... |
% HW1
% Kippeum Lee
%% Q1
X = [1,1.5,3,4,5,7,9,10]; % Much Faster X = [1, 1.5, 3:5, 7, 9, 10];
X
% generate Y1 and Y2
Y1 = -2 + 0.5*X;
Y2 = -2 + 0.5*(X.^2);
Y1
Y2
% plot Y1 and Y2 against X
figure
plot(X,Y1,X,Y2)
%% Q2
% generate X
X = linspace(-10,20,200)';
X
% sum of X
sum = sum(X);
... |
function [Interaction,kCompound,kDisease,Did,Tid]=getdata(path,dataset)
%getdata loads the the interaction information of a particular dataset
%along with the pairwise similarities between the involved miRNA and
%Disease
%
% [Interaction,kCompound,kDisease,Did,Tid] = getdata(path,dataset)
%
% INPUT
% path: the ... |
clear all, close all
graphics_toolkit gnuplot
datosmenos3=dlmread('./-3.3v/simulacion_4_-3.3.txt', '\t', 1, 0);
%%GRAFICO TEORICO 3.3
vo = -3.3;
vf = -3.15;
t = 133; %en nanosegundos
tiempomenos3 = 0 : 1 : 700;
tensionmenos3 = (vo - vf) * exp(-tiempomenos3 / t) + vf;
Ha = axes;
set(Ha,'Box','on','FontName','Arial','F... |
% figure;
% a = 0;
% den = [1 6 5 0 0];
% num = [1 2.*a a^2];
% G = tf(num,den);
% margin(G);
% % bode(G);
% print('3e_a0','-dpng');
%
% figure;
% a = 2;
% den1 = [1 6 5 0 0];
% num1 = [ 1 2.*a a^2];
% G1 = tf(num1,den1);
% margin(G1);
% % bode(G1);
% print('3e_a2','-dpng');
% figure;
% a = .5;
% den2 = [ ... |
%%% Ok this is it ...
%%% Monthly average budgeted carbon transport ...
%%% ITER 122 data for now.
%%% Remember I'm subbing in theta for neutral density.
%%% one month 3-sided regions - with box budgets. balanced...
%%% What kinda plots would I want to make?? Let's start with the same -
%%% except I have to inco... |
function y = ln(x)
y = log(x);
% in matlab, log(X) is the natural logarithm of the elements of X
% it is too easy for me to forget |
function displayResults(results, experimentData, percentsBlack, getAccuracies, plotHuman)
if ~exist('getAccuracies', 'var') || isempty(getAccuracies)
getAccuracies = @collectAccuracies;
end
if ~exist('experimentData', 'var')
experimentData = loadData('data_occlusion_klab325v2.mat', 'data');
end
if ~exist('perc... |
N = 16;
A = hadamard(N);
[m n] = size(A);
for j = 2:m
for i = j:m
sign_chg = find(diff(sign(A(i,:))));
[m1 n1] = size(sign_chg);
if n1+1 == j
break;
end
end
tmp = A(j,:);
A(n1+1,:) = A(i,:);
A(i,:) = tmp;
end
A
r1 = [A(1,:) A(1,:) -A(1,:)]
... |
clear;
% Cube vertices.
cube_vert=[ 1.0,1.0,-1.0;
1.0,-1.0,-1.0;
-1.0,-1.0,-1.0;
-1.0,1.0,-1.0;
1.0,1.0,1.0;
1.0,-1.0,1.0;
-1.0,-1.0,1.0;
-1.0,1.0,1.0];
% Cube quads.
cube_ind=[7,6,5,4;
1,0,4,5;
5,6,2,1;
3,... |
%% Flume Experiments
format compact
format short
close all
clear
clc
%% Equations
% Wing Area
syms s c su cu
PlanFormArea=s.*c;
PlanFormAreau=PartialsEquationCalculator(PlanFormArea,[s c],[su cu]);
PlanFormArea=matlabFunction(s.*c);
% Lift
syms Alpha N A Alphau Nu Au
L=N.*cos(Alpha)-A.*sin(Alpha);... |
clc;
clear all;
close all;
% Function Approximation using perceptron
%
% Function = sin(x)*cos(y)
%
constant=1000;
x=rand(1,constant)-0.5; %training table
y=rand(1,constant)-0.5;
inp=zeros(constant,2);
for i=1:length(x)
inp(i,1)=x(i);
inp(i,2)=y(i);
end
thr=0.000001;
for j=1:20
var1=2*rand(1,1)-1;
var... |
function x2=MetodoSecante(fun,x0,x1)
hn=-(((feval(fun,x1))*(x1-x0))/(feval(fun,x1)-feval(fun,x0)));
x2=x1+hn;
if(abs(hn)>0.001)
x2=MetodoSecante(fun,x1,x2);
end |
% err = orderr(M,x)
%
% ordinal distance error of the realization x w.r.t the distance rank
% matrix M
function err = orderr(M,x)
D = eucldist(x);
err = 0;
for i=1:n-2
for j=i+1:n-1
if (D(i,j) < D(i,j+1) && M(i,j) > M(i,j+1)) || (D(i,j) > D(i,j+1) && M(i,j) < M(i,j+1))
err = err + 1;
end
... |
function GenPBSscript_53_KARST_v1(DirPathLC,Email)
%09/11/2015
% Modification by pkgandhi to make log files and store under log
% directory.
% Changed ppn from 8(Quarry) to 16 for KARST. This are the maximum number
% of processors a node can contain on KARST.
% KARST has inbuilt ccm module environment. Thus it does not... |
function [ ] = PhysElecLab2CALC( )
% Using DATA collected in Lab this funcion will calculate the current in
% the junction of the base and collector of a bjt
%where:
%VBE, VBC = the base to emitter and base to collector voltages (V)
%IE, IC, IB = the emitter, collector and base currents (A)
%IEs, ICs = the emitter ... |
% test for circular shape priors
%
% Copyright (c) 2004 Gabriel Peyré
% some parameters
n = 400;
name = 'diatom';
name = 'surbiscbox';
name = 'stephanodiscusniagarae';
% load test imges
file_name = ['data/', name, '.png'];
M_original = double( imread(file_name) );
M_original = rescale(M_original);
M =... |
function [phalanges] = htrack_move(theta, dofs, phalanges)
num_thetas = length(dofs);
num_phalanges = 17;
rotateX = zeros(num_thetas, 1);
rotateZ = zeros(num_thetas, 1);
rotateY = zeros(num_thetas, 1);
globals = zeros(num_thetas, 1);
for i = 1:num_thetas
if (dofs{i}.phalange_id <= num_phalanges && dofs{i}.type ==... |
function [Time,Y,cell_history2,cell_t_history2] = vertex_restructuring(lambda0,beta0,gamma0,alpha0,eta0,T0,tend,gridsize,ext_force)
%implements vertex model with cell restructuring behaviour via T1 swaps.
%Pass output arguments into hex_vis_2 in order to view
global C N A0_vec C0_vec lambda beta gamma M alpha cell_hist... |
Dir_list=dir('suite2p*');
Dir_list=Dir_list([Dir_list.isdir]==1);
Suite2p_traces={};
S2p_concTraces=[];
ROIs={};threshold=0.5;
progressbar;
for i=1:length(Dir_list)
progressbar(i/length(Dir_list));
load(strcat(Dir_list(i).name,'\plane0\Fall.mat'));
idx_cell=find(iscell(:,2)>threshold);
Suite2p_traces{i... |
clear
clc
close all
%%
% USER-DEFINED PARAMETERS
filename = 'data.2d';
filedir = 'Z:\Data\AST\BalsaWood\CDDSol\Xylene\Sample17A_Dry\';
nMeas = 200;
G = 23.87; %T/m
zf = 1; %levels of zero-filling
omitEchoes = 0; %front-end echoes to omit
guess = [0 0.003 0.08]; %[y-offset, amplitude, T2 in s]
t0 = datetime('26-Jul-2... |
cont=numel(coord_local_estela)/2;
for k=1:60
vector(k,:)=coord_local_estela(61-k,:);
%%%%%%%%%%%vectorr(k,:)=coord_local_estela(61-k,:);
end
|
k=100;
N = 2*k+1;
F = [0:1/N:1];
H = zeros(size(F));
H((0 < F) & (F < 0.5)) = -1j;
H((0.5 < F) & (F < 1)) = 1j;
%H2 = [];
h = ifft(H);
x = -1:2/N:1;
[a b] = size(h);
h2 = [h((b/2+1):b) h(1:b/2)];
%plot(x,h2,'r');
stem(x,h2);
H2= fft(h2);
%hold on;
%plot(x,h,'b');
figure;
%plot(F,imag(H),'r');
%hold ... |
clear
close all
clc
%% %% %% %% %% %% %% %%
%% Adding paths
addpath(genpath('data'));
addpath(genpath('water-model'));
%% Choose subject
prompt = ['Which subject would you like to import data for?\nChoose 1 2 or 3\n'];
subjectNumber = input(prompt);
clear prompt
clc
switch subjectNumber
case 1
[rawStep... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.