text stringlengths 8 6.12M |
|---|
% *************************************************************************
% BEM VARIABLES
% *************************************************************************
global ListOfFreq NrOfDOF NrOfFreq DeltaFreq SYS NrOfNodes
global PathToSysnoiseRoot PathToSysnoiseFiles PathToSysnoiseMatrices PathToSysnoise
global Ma... |
%% Sampling GP Posterior and Computation of Marginal Likelihood
clear, clc
% Generating data
sig_e = 0; % std of the noise
X = [-10 -3 2 8 12]; N = length(X); Y = sin(X) + sig_e * randn(1,N);
% kernel function
delta = 3; k = @(z1,z2) exp(-(z1-z2).^2/(2*delta^2));
% kernel matrix
z = meshgrid(X); K = k(z,z');
Lambda = ... |
function [t,rec] = veryLowP2X7(ton,toff,ttot)
if nargin==2
thold=toff-ton;
ttot=2*thold+ton;
end
% tclosed=unifrnd(0.6,1.1);
topen=ton;
dt=1;
t=[0,topen:dt:toff-dt,toff:dt:ttot].';
tauact=17+1*randn();
taude=45+7*randn();
amp=6+randn();
rec=zeros(length(t),1);
%rec(t==topen)=-unifrnd(0.1,0.5);
rec(t>topen&... |
function [ring,mag_groups]=UniformGirderErrors(ring,mag_groups)
% function ring=UniformGirderErrors(ring)
%
% makes all error in a section delimited by the markers GS and GE
% identical to the ones on the first element
% of the group. Groups are defined in the lattice by the MagNum Field
%
% BPM are moved with the gird... |
function [ab_solved,df_solved,phi_solved] = XuNonUniformPhaseStep(I0_k,eps_k,phi_k,I_k)
matrix_A = [ XuTallVector(I0_k), XuTallVector(I0_k.*eps_k.*cos(phi_k)), -XuTallVector(I0_k.*eps_k.*sin(phi_k)) ];
X = XuLeastSquareSolution(matrix_A,I_k);
ab_solved = -log(X(1));
df_solved = -log(sqrt(X(3)^2+X(2)^2)/X(1));
phi_solve... |
function loadDataIntoDataBase2(conn2,newdata)
%% Accessing table notice
tablename = 'notice';
selectquery = ['SELECT ntc_id,d_rcv,d_upd, ntc_type FROM ' tablename];
curs = exec(conn2,selectquery);
curs = fetch(curs);
data = curs.Data;
noticeID = data{1};
d_rcv = data{2};
d_upd = data{3};
ntc_type = data{4};
... |
% function parseScript2odeset(file_name)
[INPUT,OUTPUT,gate_domain_info] = parseScript2domain([file_name,'.txt']);
input_species = INPUT(:,2);
output_species = OUTPUT(:,2);
gate_species = {'null'};
for c1 = 1:size(gate_domain_info,1)
gate_name = gate_domain_info{c1,1};
... |
function [] = getPicInfo( row,column,path )
I=imread(path);%读取文件
[y,x,~]=size(I);%获取文件大小
maxRow = y; %最大行数和最大列数
maxColumn = x;
%接下来的两个if判断用户选取的像素点是否超出到图像边界之外
if(row > maxRow)
disp('row index out of bound');
return;
end
if(column > maxColumn)
disp('column inde... |
%%
clear all
load('B.mat')
%%
s1=[rawStarData(:,1),rawStarData(:,5)];
s2=[rawStarData(:,2),rawStarData(:,6)];
s3=[rawStarData(:,3),rawStarData(:,7)];
s4=[rawStarData(:,4),rawStarData(:,8)];
%%
i=1;
figure(1)
clf
axis equal
grid on
hold on
set(gca,'xlim',[0 1023],'ylim',[0 1023]);
p1_plot = plot(s1(i,1),s1(i,2),'r... |
clear;
clc
nsepdata;
w = randn(1, 3);
%w = zeros(1,3);
X = [patterns; ones(1, ndata)];
eta = 0.001; %recomended: 0.001
epoch_total = 20; %recomended: 20
for epoch = 1:epoch_total
deltaW = -eta*( w*X - targets)*X';
w = w + deltaW;
p = w(1, 1:2);
k = -w(1, insize+1) / (p*p');
l = sqrt... |
% pGetModelData loads data on JAR3D models
function [GroupData, MotifEquivalence] = pGetModelData(OutputPath,loopType)
load([OutputPath filesep loopType '_GroupData.mat'],'GroupData');
try
load([OutputPath filesep loopType '_GroupData_with_full_cutoffs.mat'],'GroupData');
fprintf('Loaded GroupData with model-spe... |
% def_data -- Called by WLBrowser
% Usage
% def_data
%
% Description
% Load WaveLab datasets
%
function x = def_data(i)
do_global
data_name = Data____entries( i+1, : );
while data_name( length(data_name) ) == ' '
data_name( length(data_name) ) = [];
end
if i < 7
x = ReadSignal(data_name);
signal_name... |
function Fourier_3D_field
%Fourier_3D_field See penetration of mode in psi-m plane with m poloidal wave number
% Detailed explanation goes here
global par maps dim
%% CLEAN
delete(findall(0,'type','figure','tag',mfilename));
unit_test=false;
%% UNIT TEST
if unit_test
warning('Executing a UNIT TEST!') %#ok<*UNRCH... |
function p = waw_gss( t, s )
%WAW_GSS - First guess for the parameters of the WAW model
%
% Syntax: p = waw_gss(t,s)
%
% p(1) = a = slope of Jacob Straight Line
% p(2) = t0 = intercept with the horizontal axis for
% the early time asymptote
% p(3) = t1 = intercept with the horizontal axis for
% ... |
function str = printStructure(structure, varargin)
% printStructure(structure, FID) prints all fields and values of
% 'structure' to file 'FID'.
%
% printStructure(structure, FID, settings) prints 'structure' to file 'FID'
% with additional settings.
%
% printStructure(structure, settings) prints 'structure' to scree... |
function vq = triang_shepard2D(x,y,v,xq,yq,p,T)
% Opis:
% Izračuna interpolacijo dvodimenzionalnih točk v prostoru s pomočjo
% trikotniške Shepardove interploacije.
%
% Definicija:
% vq = shep1(x,y,v,xq,yq,p)
%
% Vhodni podatki:
% x, y, v vektorji koordinat znanih točk,
% xq, yq mreži x in y ... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2010 - 2015 Moon Express, Inc.
% All Rights Reserved.
%
% PROPRIETARY DATA NOTICE:
% The data herein include Proprietary Data and are restricted under the
% Data Rights provisions of Lunar CATALYST Space Act Agreement
% No. SAAM ID#... |
function P_trans = R_inv(P, R, T)
%R,T is a transform from the basis axis to a given axis. P_trans is the
%coords in the basis axis.
P_trans = R'*(P - repmat(T, 1, size(P,2)));
end |
% ARMA模型参数估计,已知噪声信号。p为AR阶数,q为MA阶数
function [B_est,A_est2] = ARMA_YuleEst(p,q,InputSignal,InputNoise,SignalLength)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
X=InputSignal(1:SignalLength,1);
X=X';
Noise=InputNoise(1:SignalLength,1);
Noise=Noise';
N=length(X);
... |
function rand_ind=RAND(X,Y)
a=0;
b=0;
c=0;
d=0;
rand_ind=-1;
if (size(X,1)==size(Y,1))
for i=1:size(X,1)
for j=1:size(Y,1)
if (i~=j)
if(X(i)==X(j) && Y(i)==Y(j)) a=a+1;
end
if(X(i)~=X(j) && Y(i)~=Y(j)) b=b+1;
end
if(X(i)==X(j) && Y(i)~=Y(j)) c=c+1;
end
if(X(i)~=X(j) && Y(i)==Y(j)) d=d+1;
en... |
close all;
clear all;
r1=1600;
r2=5000;
s=tf('s');
h= @(k) 1/((s/k)+1);
Qz=@(k) ((2.*r1+r2).*10.*r2)./((r2.*r2.*10-k.*k.*r2.*r2 -9.*k.*r2.*r2+r1.*r1+31.*r1.*r2)*sqrt(2+(r2/r1)));
Qp= @(k)((2.*r1+r2).*10.*r2)./((11.*k.*r2*r2-k.*k.*r2*r2+r1*r1+31*r1*r2).*sqrt(2+(r2/r1)));
K=0:0.001:1;
plot(K,Qp(K)./Qz(K),'LineWidth',... |
%circular convolution using linear convolution
x1=input('Enter the first sequence');
x2=input('Enter the second sequence');
N1=length(x1);
N2=length(x2);
N=N1+N2-1;
p=N-N1+1;
y=conv(x1,x2);
disp(y);
z=zeros(1,N1);
for m=p-1:N1-1
z(m+1)=y(m+1);
end
for n=0:p-2
z(n+1)=y(n+1)+y(N+n-2);
end
disp(z);
|
function [block64out] = des_initial_permutation(block64in)
% DES_INITIAL_PERMUTATION(BLOCK64IN), permute bit, used before applying des first round
ip = [58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43,... |
function [angles] = compute_baseline_angles_between_camera_pairs2(...
camera_pairs, camera_data, point_data, camera_observations)
num_pairs = size(camera_pairs, 1);
angles = zeros(num_pairs, 1);
init_matlabpool(12);
parfor i = 1:num_pairs
cam_idx1 = camera_pairs(i,1);
cam_idx2 = camera_pairs(i,2);
... |
function [ u ] = analytical( x,dt,steps )
N = 100;
u = zeros([1 length(x)]);
t = steps * dt;
v = 0;
for i = 1:length(x)
for k = 1:N
A = (2*(-1)^k/(k*pi));
v = v + (A .* sin(pi .* k .* x(i) .* exp(-(k.*pi)^2.*t)));
v = v + x(i);
end
u(i) = v;
end
end
|
function [y,u,c] = CoutteNewtonianFluid3(U,h,mu)
%COUTTENEWTONIANFLUID: returns horizontal velocity u and height y as
%vectors, and plots u vs. y
%
%input argument:
% U Velocity of top plate
% h Distance between top plate and bottom plate
% mu Sheer rate
%
%out... |
function [coeff,norm2_res]=polminquad(x,y,m)
% inicialitzem la matriu A
N = length(x);
A = ones(N, m + 1);
for i = 1:N
for j = 1:m
A(i, j + 1) = x(i)**j;
endfor
endfor
% calculem les matrius Q i R
[Q, R] = QR(A);
% imprimim les normes
%disp(sprintf("1-norm of Q'Q - Id = %e", norm(Q... |
function [] = TestRF_MLP()
% multi-layer perceptron trained with backprop to learn output neural
% activity
% 3D Gabor wavelets
warning('off','all');
train = 0.8;
cellinfo
numCells = length(celldata);
neuralResponse = cell(numCells,1);
for ww=1:numCells
load(celldata(ww).datafile,'resp');
neuralResponse{w... |
% amplitude of the B field at local positions
% if NO_PERTURB_ORBITS==0
% if ~isempty(OUTER_PART)
% alphas_Bfield(OUTER_PART)=interp2_XZ(interp_x,interp_z,Btot_XZ_map,INDEX_LIST_1,INDEX_LIST_2,INDEX_LIST_3,INDEX_LIST_4,OUTER_PART);
% end
%
% alphas_Bfield(INNER_PART)=lininterp3(Btot_map_phi,IL3D_1,IL... |
% Pogo - a finite element package to simulate elastic wave propagation on the GPU
% Copyright (C) 2013 Peter Huthwaite
%
% This file is part of the Matlab post-processing tools made available with Pogo.
%
% If you find Pogo useful in your academic work, please cite the relevant papers;
% information on our latest pap... |
function [F] = fun2( x,y,W_j,a,b,n )
global Q_1j Q_2j alfa_i alfa_o dm D omega_i f
T=35;
Po=3*Q_1j*sqrt(1-(x/b(1)).^2-(y/a(1)).^2)/(2*pi*a(1)*b(1));%赫兹压力
Pi=3*Q_2j*sqrt(1-(x/b(2)).^2-(y/a(2)).^2)/(2*pi*a(2)*b(2));%赫兹压力
Ro=2*f(1)*D*1e-3/(2*f(1)+1);
ro=(Ro^2-y.^2).^0.5-(Ro^2-a(1)^2)^0.5+((0.5*1e-3*D)^2-a(1)^2)^0.5;
Ri=2... |
function model_intensity = intensity( obj )
%% Network.ModelFit#intensity calculates the intensity function on the network.
% First, we calculate a network tesselation and measure the covariates
% there; On the cells of this network tesselation, we compute the
% intensities from the covariates and the cell length. Th... |
% reset_data_analysis_environment
close all;
rmix=radial_r_value_flux(size_r-4)
PRECESS_LAMBDA_BIN_SIZE=0.1;
precession_lambda_bins=(1*PRECESS_LAMBDA_BIN_SIZE:PRECESS_LAMBDA_BIN_SIZE:12*PRECESS_LAMBDA_BIN_SIZE);
lambda_values=(1.5*PRECESS_LAMBDA_BIN_SIZE:PRECESS_LAMBDA_BIN_SIZE:11.5*PRECESS_LAMBDA_BIN_SIZE);
lambda... |
function SimMat = SpAssoc_SimMeasure(HistArray,RegionSize)
%% this function compute the similarity between superpixel associations
% Input:
% HistArray - an array of histogram representation of the superpixel
% associations,each row represent the histogram of one sp assoc.
% RegionSize - the size of the superpixe... |
classdef emg < handle
% EMG - A class to store muscle activation data recorded from experiments
%
%
% Created by Megan Schroeder
% Last Modified 2014-03-27
%% Properties
% Properties for the emg class
properties (SetAccess = private)
SampleTime
... |
function G = givens(x1,x2)
%GIVENS appy rotation to the input vectors
% wrapper for missing givens function in sRRQR repository.
[G,~] = planerot([x1;x2]);
end
|
classdef SubDaySummary
properties
trials
num_cells
num_trials
trial_indices
full_num_frames
end
methods
function obj = SubDaySummary(val)
obj.trials = val.trials;
obj.num_cells = val.num_cells;
obj.num_trials = val.num_trial... |
function [x_pks_arr,y_pks_arr] = func_find_apex_rot(xh,yh,X,Y,plt_flg)
% This function looks for the apexes of the sinusoidal helices wrapped
% around around a catheter in the X-Y projection view
% Anne Yang 2018.09.17
% --------------------------------
% Input variables--
% xh: helix x-coordinate
% yh: helix y-coo... |
format compact
% when use 's' in input function, it means it's going to receive a string,
% otherwise it can get any type of value, such as vector, operations and matrix
name = input('What is your name? ', 's');
if ~isempty(name)
fprintf('Hello %s\n', name); % fprintf is similar to printf from C
else
disp(... |
clear all
% decay.m
%rate constant
k=0.1;
%initial concenttration
y_0 =10;
% %time varieble
t= 0:5:50;
%
% %cal y
% y(idx) = y_0*exp(-k*t(idx))
%for loop
for idx = 1:length(t)
y(idx)=y_0*exp(-k*t(idx));
end
plot (t,y) |
function SIG_GENES=GetSigGenes(GE_DATA,ANOT_DATA,CHIP_DATA,ANAL_TYPE,varargin)
% GetSigGenes
% Get Significantly Altered Genes
%
% SIG_GENES=GetSigGenes(GE_DATA,ANOT_DATA,ANAL_TYPE)
%
% GE_DATA Gene Expression Structure created from
% LoadAnnotatedGEData
% ANO... |
function [] = rdt_nextbutton
global rdt_nt;
global rdt_badtrial;
global rdt_fh;
global rdt_trialnumber;
global rdt_filename;
global rdt_includeaborted;
global curtasktype;
rdt_trialnumber = rex_next_trial( rdt_filename, rdt_trialnumber, rdt_includeaborted );
%rdt_displaytrial_WORKING
rdt_displaytrial(... |
function [M,Thick_protein_slice,SLD_protein_slice,SLD_layer,Vol_hydrate,slice_Vol, Vol_protein_slice] = Histogram_gro(average_z_res_T,Residues,SLD_of_average_z_res,Vol_of_average_z_res,protein_box_x,protein_box_y,protein_box_z,D2O_frac)
% all gro files
%3
SLD_solvent = D2O_frac*(6.35e-6+0.56e-6)-0.56e-6;
boxarea = pro... |
function [fr_bw,width,height,w,mean,sd,u_diff,rank]=initializations(source,C,alpha,sd_init)
%--------------------------Video Initialization_---------------------------
%
% function [fr_bw,width,height,w,mean,sd,u_diff,rank]=initializations(source,C,alpha,sd_init)
%
%Initialization of arrays for better memory... |
function [data,vars,X,annotation,TransNames]=chipDynoTuLoadData();
% CHIPDYNOTULOADDATA loads Tu Data with Lee et al ChIP data.
% CHIPDYNO
[probeName, data, vars] = chipTuTextRead;
data=data(find(sum(vars,2)),:);
probeName=probeName(find(sum(vars,2)));
vars=vars(find(sum(vars,2)),:);
dataChip=load('./data/Connectivi... |
function combPlane = CombinePlanes(plane)
mult = 2;
combPlane = plane{1}-1;
for n = 2:length(plane)
combPlane = combPlane+(plane{n}-1)*mult;
mult = mult*2;
end
combPlane = combPlane+1; |
function [xy varargout] = circle(D, dx)
% @author M.Moriche
% @brief Function to generate points laying on a circumference.
%
% @details
%
% Generates points laying on a circumference. The arclength between points
% is the closest value possible to dx, having an associated volume
% of the marker $vol similar to dx^2.... |
%% Machine Learning Online Class
% Exercise 5 | Regularized Linear Regression and Bias-Variance
%
% Instructions
% ------------
%
% This file contains code that helps you get started on the
% exercise. You will need to complete the following functions:
%
% linearRegCostFunction.m
% learningCurve.m
% v... |
function [ax,ay,az,gx,gy,gz,date_time,temp,pressure,bias] = import_tag_gyro2(filename)
% Import tag data from the gyroscope, interpolating datetime.
%
% [ax,ay,az,gx,gy,gz,date_time,temp,pressure] = import_tag_gyro2(filename)
% Pressure, which is currently not implemented, returns 0.
filename = strcat('data/', filename... |
clearvars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%generate ERA5 maps of basic vars which can be compared to ours
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
% input struct p with fields: 'vertices' and 'faces'
% outputs:
% b: all boundaries in Nb x 2 array
% vb: boundary points in (Nb-1)*3 array for plotting, e.g.
%
% where Nb is number of boundary edges
function [b,vb] = meshboundary(p)
v = p.vertices;
f = p.faces;
% [~,ed] = computeMeshEdges(f); % function in geo... |
% OPTIMUM INCIDENCE AND DEVIATION (ALREADY COMPUTED)
% DESIGN INCIDENCE
i_des_rott = i_mt;
i_des_rotm = i_mm;
i_des_roth = i_mh;
% DESIGN DEVIATION ANGLE
ddelta_di_t = ( 1+(sigma_R_t+0.25*sigma_R_t^4)*(abs(beta_1_t)/53)^2.5 )/exp(3.1*sigma_R_t);
ddelta_di_m = ( 1+(sigma_R_m+0.25*sigma_R_m^4)*(abs(beta_1_m)/53)^2.5 )... |
function torque = getTorque(motor, speed, currLim)
% A function to determine the max amoount of torque a given electric
% motor can produce given the current rpms and current limit
% ASSUMES FREE CURRENT = 0A
torque = motor.stallTorque .* (1 - (speed ./ motor.freeSpeed));
curr = motor.stallCurr .* (1 - (speed ./ moto... |
% clear;
clc;
fileID=fopen('E:\Project\Weizmann Files\New\HOG1.csv','a'); % path for output csv file
total=2000; % Total number of features
for k=1:total
fprintf(fileID,'att_%d,',k); %Writing into csv file as columns
end
fprintf(fileID,'Class'); %Last Column
fprintf(fileID,'\n');
path... |
function y = h3b(x, measpar)
% Measurement function
%
% The measurement function gives the measurements available to the agent.
%
% Input arguments:
% x - the complete state vector of all agents in the multi-agent system
% measpar - structure containing parameters used in the function. In
% this case t... |
function [Xjoining,Yjoining,Xsplitting,Ysplitting,VsegmentAJ_acNr1, ...
VsegmentBJ_acNr2,syncPossible,timeAdded_acNr1,timeAdded_acNr2] = ...
determineRoutingAndSynchronization(wAC,wBD,wDuo,Xordes,Yordes,Vmin, ...
Vmax)
%% determineRoutingAndSynchronization.m description
% Determines an initial joining and s... |
classdef TargetProperty
properties
% measurements
obs; %observation
new_obs; %new_observation
num_keypoints = 0; % the number of keypoints
% GP model parameters
hyper_param_x;
hyper_param_y;
GP_Model = cell(1, 2);
model;
... |
a1 = 0;
a2_0 = 0;
a2_1 = 40.09;
a2_2 = 144.54;
a2_3 = 182.62;
a2_4 = 516;
a2_5 = 96;
a3_0 = 40.09;
a3_1 = 40.09;
a4 = 0;
a5 = 0;
a6 = 0.91;
a7 = 0.91;
alph1 = pi/2;
alph2_0 = -pi/2;
alph2_1 = 0;
alph2_2 = 0;
alph2_3 = 0;
alph2_4 = 0;
alph2_5 = 0;
alph3_0 = -pi/2;
alph3_1 = -pi/2;
alph4 = 0;
alph5 = pi/2;
alph6 = -pi/2... |
function varargout = load_expm(varargin)
%LOAD_EXPM Explicitly load a plugin dynamically.
%
% LOAD_EXPM(char name)
%
%
%
%
[varargout{1:nargout}] = casadiMEX(853, varargin{:});
end
|
y0 = 1;
tspan = [0 1];
[t, y] = ode45(@(t,y) -10*y, tspan, y0);
plot(t,y); |
%% Matlab Code for AutoSpider for ADC_MAP
% add path where matlab code is from inputs:
addpath(genpath('${matlab_code}'));
% Paths:
mkdir('${temp_dir}/outputs');
mkdir('${temp_dir}/OsiriX');
% Get dicoms:
dicoms = '${dicoms}';
[dcmpath, dcmname, dcmext] = fileparts(dicoms);
if strcmp(dcmext, '.zip')
cmd = sprintf('c... |
%Andrew Brown Lab 5 Problem 1
clc
clear
close all
%Plot last year's ENGR112 data by type
% Script to read in 2D array of grade data
% Also provides column names
dataN = csvread('DataClass.csv');
strColumns = {'LabQuiz', 'zyBooks', ...
'Labs', 'Homeworks', ...
'MidtermI', 'MidtermII', 'Final', ...
'ExamAv... |
function [X,P,X_arr,Q,F,H] = setX_P_Xarr_Q_F_2d(n,dt)
dim = 4;
X = zeros(dim,1); % state matrix
P = eye(dim)*2; % covariance matrix
X_arr = zeros(n, dim); % KF filter output through the whole time
Q = [0.02 0 0 0;% system noise
0 0.05 0 0;
0 0 0.02 0;
0 0 0 0.05];
F = [1 dt 0 ... |
function [d,di] = asol(f, fr, opt)
%--------------------------------------------------------------------------
%
% Copyright (c) 2013 Jeffrey Byrne
%
%--------------------------------------------------------------------------
%% Inputs
if ~exist('opt','var')
opt = nsd.opts().sol;
end
%% Gaussian pyramid
oe_gpyr =... |
% Solution_Curve_ODE.
% Copyright Springer 2013. Stephen Lynch.
% See Figure 1.2.
deqn=@(t,c) .00713*(4-c)^2*(1-c/2);
[t,ca]=ode45(deqn,[0 400],0);
plot(t,ca(:,1));
axis([0 400 0 3]);
fsize=15;
set(gca,'xtick',0:100:400,'FontSize',fsize);
set(gca,'ytick',0:1:3,'FontSize',fsize);
xlabel('t','FontSize',fsize);
... |
clear;
type compact;
syms x;
diff(x^2);%compute
disp(ans);%disp
diff(x^2*exp(2*x));%compute
disp(ans);%disp |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
% Fourier Series properties
% Time scaling
syms t
t0=0;
T=2*pi;
w=2*pi/T;
x=t*cos(t) ;
k=-5:5;
a=(1/T)*int(x*exp(-j*k*w*t),t,t0,t0+T);
a1=eval(a)
subplot(211);
stem(k,abs(a1));
legend('Magnitude'... |
function smoothed_cnt = smooth(this)
%% Load default
default = getdefault(this);
MaxAllowedSqDist = ( default.maxalloweddist ) ^2;
smoothfactor = default.smoothfactor;
%% Load data
C = this.coords;
x = C(:,1);
y = C(:,2);
%% Smooth
initialbreaks = 1:smoothfactor:length(x)... |
% Artur's solution
clear all;
load hospital;
hospital.SysPressure = hospital.BloodPressure(:,1);
hospital.DiaPressure = hospital.BloodPressure(:,2);
numeric_data=[hospital.Age,hospital.Weight,hospital.DiaPressure,hospital.SysPressure];
disp('covariance matrix')
cov(numeric_data)
disp('correlation matrix')
corrcoef(nume... |
% comparison of hyps learners vs exact:
% check how well each does over a range of hyperparameters
% uses cvwl
addpath('gpml-matlab-v3.1-2010-09-27');
startup;
warning('off','all'); % gotta love playing with fire
n_expts = 1;
n_reps = 2;
n = 1000;
m = 50;
output = 'expt6_results';
results = zeros(n_expts, 10); % fr... |
function X = Restrict(X, t0, t1)
% R = Restrict(X, t0, t1)
% Returns a new tsd R so that D.Data is between
% timestamps t0 and t1, where t0 and t1 are in units
% NOTE: assumes units provided are the same as the units in the tsd
% NOTE: D will be returned in its original units!
%
% ADR 2000
% version 6.0
% v4.1... |
%comparison slin with spg?PDMM, SADMM, PA-APG
clear;
clc;
%% Prepare the data
ng=100; % number of groups
g_size=100; % group size
overlap=10; % number of variables overlapped between two consecutive groups
n=1000; % sample size
p=ng*(g_size-overlap)+overlap; % total number of variables
input.EPI = 1e-4;
in... |
function [retval,nTraces] = traceStat( varargin )
% LOADTRACES Loads fluorescence trace files
%
% NAMES = traceStat;
% Returns the names of each trace statistic as a structure.
%
% STATS = traceStat( DONOR,ACCEPTOR,FRET, const )
% Calculates metadata from fluorescence/FRET traces that can be
% used as pickin... |
function [f_estimated] = HR_estimator(f,FoM)
%Takes array of figure of merit of frequency where a higher figure means
%higher probability of the heartbeat lying at this frequency.
%
%normalize log FoM
FoM = FoM - min(FoM);
%Remove outliars would be interesting
%weights = exp(sqrt(abs(FoM)));%Since FoM is p... |
function plot_pspec(K,S,pspec,eta0)
% plot(-K+1:K,pspec,'k',-K+1:K,eta0,'LineWidth',2)
plot(-K:K-1,pspec,'k','LineWidth',2)
h = set(gca,'FontSize',30);
set(h,'Interpreter','LaTeX')
xlabel('$K$','Interpreter','LaTeX','FontSize',30)
ylabel('$\log_{10}\left|\hat{\eta}(k,t_{f})\right|$','Interpr... |
function accuracy = knn_classifier_ding(data,fea_sel,k)
d_length = length(data);
%% divide data to train and test set
train_data = data(1:d_length/2,:);
test_data = data(d_length/2+1:end,:);
%% operate the active feature user selected
train_fea = train_data(:,fea_sel);
test_fea = test_data(:,fea_sel);
... |
function [n,bin] = histw(varargin)
[cax,args,nargs] = axescheck(varargin{:});
y = args{1};
x = args{2};
if nargs > 2
w = args{3};
else
w = ones(size(y));
end
bin = sort(x);
n = zeros(size(bin));
for i = 1:length(y)
temp = find((bin-y(i))>=0);
if length(temp) > 0
n(temp(1)) = ... |
function vad_directed_by_noise_classification
clc
clear all
close all
%% download from http://spib.rice.edu/spib/select.
noise = wavread('white_8000.wav'); % noise signal, it can be changed!
db = 5; % SNR
sig = wavread('s18.wav'); % clean speech signal
label = wavread('l18.wav'); % vad label
hlab=vadla... |
%Programa: teste4.m
%Método de Gauss-Jacobi
clear all;
A = [ 10 1;
1 5 ];
%b = [1; 1];
%b = [1; 2];
%b = [1; 3];
b = [1; 4];
tamanho = size(A);
n = tamanho(1);
%Construindo Vetor g
g = zeros(n,1);
for i = 1:n
g(i)=b(i)/A(i,i);
end
display(g);
%Construindo Matriz C
C =... |
%% FASE ACQUISIZIONE RISULTATI SCOPE
risultato_scope = xlsread('test_accuratezza_elab2_OpenMp.xlsx','C4:I4');
risultato_scope = risultato_scope'
%% ACQUISIZIONE RISULTATI IN MATLAB - 10^5 ELEMENTI
n = 8;
A = load('matrice.mat');
x = ones(1,n)';
risultato_matlab = A.A*x
errore_relativo = norm(risultato_matlab-risultat... |
classdef Plane
% Plane Summary of Plane
% This class is meant for initializing the simulation plane with the
% aircraft and their conflict zones on it
%
% Plane properties:
% ac_figure_handles - aircraft agent visualization
% conflict_handles - conflict zone visualizat... |
function savecx_movie(filename, notes, dmns, images)
% SAVECX_MOVIE(filename, notes, dmns, imgmtx)
% save the image files as a cortex readable image file.
% filename, path should be included
% notes, maximume 10 characters
% dmns=[depth, x, y, nframes], in which
% ... |
function vehicle = rocket_nominal(input_file)
% Generates a MATLAB struct that contains all the static
% properties of a rocket from a file.
% There isn't any fine control on
% what happens to each field which suggests that perhaps
% an object oriented approach would perhaps be better in
% the future. At the m... |
clear all
clc
%% outline
% %%%%%%%%%%%%%%%%%%%
% use XP ser to train ANN
%
% %%%%%%%%%%%%%%%%%%%
% input:
% atom dis
% %%%%%%%%%%%%%%%%%%%
% output
% 01. en
% 02. ch (mull)
% 03. ch (resp)
% 04. fs
%% cd path
% cd /raid4/data/liyan/work_2011b/work_ANN_ml/work_ANN_XP_ser/m_files
cd /data/liyan/work_matlab/work_ANN_... |
%%常用的运算符号
a = magic(3)
b = pascal(3)
c =a'
d = inv(a)
disp('a/b');
disp('inv(a)*b');
inv(a)*b
disp('a^3')%矩阵幂运算
a^3
disp('a.*b'); %数组运算,对应位置乘积
a.*b
disp('a.\b');%数组运算,对应位置相除
a.\b
a./b |
function [Low_tracks_out] = TrackletsMergePredictionDist_V2(Low_tracks_in,ThreSeg,ThreMDist,CharFun)
% duration criteria: 1)startpoint and endpoint threshould ThreSeg(1);2) duration
% threshold ThreSeg(2)
% IoU criteria: 1) the difference between the most and secondly related
% IoU ThreM(1); 2) the most related... |
function S_figArray = plotting_getFigArray(S_dataArray,fig_type,opt_islin,opt_isdec)
%initialize
len = length(S_dataArray);
if strcmp(fig_type,'2DfieldFFT') || strcmp(fig_type,'2DcoeffsFFT') || strcmp(fig_type,'DcoeffsFFT')
S_figArray(len) = plotting_getFigStruct(S_dataArray(len),fig_type,opt_islin... |
[G, is_ext_node] = load_rommes('r_network_int46k_ext8k_res67k_public');
c = components(adj(G));
ci = 1400;
Gn = G(c==ci, c==ci);
is_ext_noden = is_ext_node(c==ci);
N = 20; % number of connected components to create in first step
n = length(Gn);
% Create huge matrix of N connected components
GnList = repmat({Gn}, 1, ... |
function [E_interpolated] = error_natural_neighbor(X, Y, ... % initial x and y coordinates (station coordinates)
E, ... % initial error values
X_grid, Y_grid) % the grid to perform interpolation on
% ... |
function [x_sample, y_sample, z_sample] = SampleFree_Scanning(final_states, map_width, map_height, map_length)
% this function generates the x-/y- and z-coordinates of a random sample
% point around the final states
check_index=randi([1,2]);
if check_index==1
x_sample=map_length*rand;
y_sample=ma... |
function [areas] = estimateAndSaveFilesArea(storageFile, ...
files, areaNoOfTestPts, areaReferenceDistance)
%Estymacja powierzchni dla listy plików. Jeśli istnieje to jest wczytywana
%z pliku. Jeśli nie to jest tworzona i zapisywana w pliku.
if exist(storageFile, 'file')
areas = ioReadVector(storageF... |
% Copyright (C) 2007-2014 German Aerospace Center (DLR/SC)
%
% Created: 2014-04-14 Martin Siggel <Martin.Siggel@dlr.de>
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apac... |
% This script tests the function bisection.m on a nonlinear function
% contained in the file f.m. It uses an initial interval [-5,5], and solves
% for the root to a tolerance of 1e-4.
%
% Aaron Krauss - originally Dr. Reynold's program
% Math3315/CSE3365
% Spring 2010
%
% set the initial interval, max iterat... |
%IDM model returning acceleration of the IDM vehicle.
% This function is based on the model shwon in "Martin Treiber and Arne Kesting. 2013. Traffic Flow Dynamics. (2013)."
function AccelCmd = IDM(v,h,hdot,uMin,uMax,params)
% v : current vehicle speed
% h : bumper-to-bumber distance
% hdot :
% delta = 4;
% a = 1;
%... |
%Example script for the code in this folder, aimed at evaluating feature
%correspondances of our robot data. See ReadMe.txt
%
% Anders Dahl &
% Henrik Aanęs
% DTU Informatics
% Technical University of Denmark
% haa@imm.dtu.dk
% Dec. 2011
clear all
close all
clc
tic
cSet=1; %The scene or set
cIm=30; ... |
% The function takes in the subtracted datastructure and 2 int numbers
% And fit the data in that regime
% Yen 20161223
function result = Guinier(datastruct, startpoint, endpoint)
q = datastruct.q(startpoint:endpoint);
int = datastruct.int(startpoint:endpoint);
err = datastruct.err(startpoint:endpoint);
[a,b,... |
clear all
va = 80
vb = 80*exp(i*-120/180*pi)
vc = 80*exp(i*-240/180*pi)
za = 5
zb = 2-3i
zc = 4+3i
Ia = va/za
Ib = vb/zb
Ic = vc/zc
In = Ia+Ib+Ic
[abs(Ia) angle(Ia)*180/pi]
[abs(Ib) angle(Ib)*180/pi]
[abs(Ic) angle(Ic)*180/pi]
[abs(In) angle(In)*180/pi]
sa = Ia*za*conj(Ia)
sb = Ib*zb*conj(Ib)
sc = Ic*z... |
function [ y ] = my_hardlims( n )
%MY_HARDLIMS symmertric hard limit function
y = ((n >= 0) - 1/2) * 2;
end
|
query = fileread('006_query.js');
results = store.aggregate(query);
h = figure;
for i=1:numel(results)
subplot(1,3,i);
hold on
holdout = results(i).holdout;
for j=1:numel(results(i).preprocessor)
loss = results(i).loss(j,:);
ii = sorti(holdout);
plot(holdout(ii), 1-loss(ii));
... |
clc ;
clear all ;
close all ;
m=0;
k1 = 10;
n= 0 ;
xn = zeros(4,10000) ;
yn = zeros(4,10000);
Tnew = zeros(4,10000) ;
thetan = zeros(4,10000) ;
v = zeros(4,10000) ;
w = zeros(4,10000) ;
for K=0.1:0.2:0.7
m= m+1 ;
e1 = 0;
l = 0;
e2 = 0;
eo1 = 0;
eo2 = 0;
xf = 0;
yf = 0;
E = [e1 ; e2] ;
U = [0 ; 0] ;
theta1 = 0;
xp = 0;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.