text stringlengths 8 6.12M |
|---|
clc
clear all
load('proj_fit_14');
%load the input data
mesh(id.X{1},id.X{2},id.Y');
%mesh the input data
m=input('grade of polynomial m=');
%user choice given degree of the polynomial used for approximating the
%unknown function
for i=1:m
%computation of the mean sqaured error for both datasets(id,val)
... |
function [ status, message ] = op_YTfit( data_handle, option, varargin )
% op_YTfit peak calcium value estimate using more accurate FLIM calcium
% baseline estimate and dF/F0 calium transient traces
% reference: Yulia's programme
% Input: Ca0 = uM, resting calcium value
% kon_I = 1/(uM ms), kon rate of... |
function [phi,psi] = sn(EDGE,NFM,SigT,SigS,RegMat,Source)
% function [phi,psi] = sn(EDGE,NFM,Sigma,RegMat,Source)
% This function solves the one-speed transport equation in slab geometry
% using the discrete ordinates method. The S4 and diamond difference
% approximations are implemented, and only vacuum bounda... |
% calculate rate of OH + o-xylene -> products
% Updated 6/10/15
% Based on MCM v. 3.3
% rate = kOHoxylene(T,M)
% O-xylene, Ortho-xylene
function j = kOHoxylene(T,M)
j = 1.36e-11; |
% runme script for homework assignments.
% Here: homework #9
% Keep the next three lines.
clc
clear;
close all;
%===========================================
% (9a)
run r9a;
fprintf(1,'Enter to continue...\n');
pause;
% (9b)
run r9b;
fprintf(1,'Enter to continue...\n');
pause;
% (9c)
run r9c;
%... |
classdef AccessPoint < handle
methods
function send(obj, package)
for i = 1 : numel(obj.links)
obj.links{i}.push(package);
end
end
function push(obj, package)
obj.cache.push(package);
end
function package =... |
function num = trunc(x, y)
%trunc
%truncates a number x to a a maximum of y digits
time1=clock;
num=x;
dig=0;
first=0;
neg=x<0;
while fix(num)~=0
num=fix(num/10);
if first==1
dig=dig+1;
end
first=1;
end
if dig==0
num=x;
while fix(num)==0
num=num*10;
dig=dig-1;
end
en... |
function y = isarray(x)
y = isnumeric(x); |
function set_hyper_path(varargin)
% function set_hyper_path(varargin)
%
% sets path for hc-hyperalign project @ MIND 2018, and returns location of
% data folders to analyze
%
% WARNING: restores default path
%
% INPUTS
%
% (optional cfg struct fields, values below are defaults)\
% cfg.vandermeerlab = 1; % add vanderm... |
function [cost, grad] = softmaxCost(theta, numClasses, inputSize, lambda, data, labels)
% numClasses - the number of classes
% inputSize - the size N of the input vector
% lambda - weight decay parameter
% data - the N x M input matrix, where each column data(:, i) corresponds to
% a single test set
% labels -... |
% if you want to apply CO2 resistance correction for elevated CO2
% Kruijt, B., Witte, J.P.M., Jacobs, C.M. and Kroon, T., 2008. Effects of rising atmospheric CO2 on evapotranspiration and soil moisture: A practical approach for the Netherlands. Journal of Hydrology, 349(3-4), pp.257-267.
if isvar(degrees)
if degrees=... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% IR Tools
% December 2018
%
% This file is part of the IR Tools package and is distributed under the
% 3-Clause BSD License. A separate license file should be provided as
% part of the package.
%
% Copyright 2018 Silvia Gazzola, Uni... |
%% PLOT_RECORDED_DATA, load and plot the measurement data from the UR5.
% mat_folder_name = 'RecordedUR5Data/Movement_No1/mat_files/';
% mat_folder_name = 'RecordedUR5Data/Movement_No2/mat_files/';
mat_folder_name = 'RecordedUR5Data/Movement_No3_Acc/mat_files/';
% data_names = {'force_sensor', 'i_actual', 'i_target',... |
%
% Digitized data from Johnson and Cook (Copper sample) p.546
%
ax = [[1990 5303];[1990 2366]];
dat = [[1990 5303];[1436 5303];[1456 5064];[1471 4829];[1472 4605];[1473 4357];...
[1483 4138];[1494 3914];[1500 3685];[1516 3474];[1546 3250];[1547 3031];...
[1776 3031];[1990 3031]];
%
% Convert the data ... |
function [] = check_if_kidnapped_are_found (BorderToExamine);
%
% [] = check_if_kidnapped_are_found (BorderToExamine);
%
% This function checks if BorderToExamine is one of the kidnapped borders (*see
% attachments). If it's true the function rescue (*see
% attachments) the border.
%
% Input of this function is... |
function [result_image, result_centers, result_scores] = ...
candidates_from_connected(depth_image, pixel_scores, binary, parameters)
% function [result_image, result_centers, result_scores] = ...
% candidates_from_connected(depth_image, pixel_scores, binary, parameters)
[rows, cols] = size... |
%% Edge detection using Laplace Impulse response
img=im2double(imread("myImage.jpg"));
whos img
subplot(2,2,1)
imshow(img)
title("Real Image")
%% Laplace impulse response function
h1=[1,-2,1];
h2=[1;-2;1];
h=[0,1,0;1,-4,1;0,1,0];
%% convolution with real image
edgeImg=conv2(img,h);
subplot(2,2,2)
imshow(e... |
classdef ElectricalObject < matlab.mixin.Heterogeneous
%OBJECT Summary of this class goes here
% Detailed explanation goes here
properties
name
x
y
width = 80
height = 60
orientation
simscapeObjName
simscapeObjPath = 'fl_lib/Electrical'
... |
% close all
% clc
% clear all
function [final_loc,final_vel]=Flock()
%[value,index] = max(map)
numRobots = 6;
N=numRobots;
global goToX;
global goToY;
global spill;
%spill = Enviornment
figure
hold on
% %%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%
% disp("Initializing Spill")
% n_... |
%%%%%%%%%%%%%%%%%%%%%%%%%%
%(c) Ghassan Hamarneh 1999
%%%%%%%%%%%%%%%%%%%%%%%%%%
function TerminateNotContinue=TryWeights(MeanShape,tEigenvectors,tEigenValues,ContoursEndingPoints);
%function TerminateNotContinue=TryWeights(MeanShape,tEigenvectors,tEigenValues,ContoursEndingPoints);
%created on July 8th, 2004, to prod... |
function [filtered,
|
%O2_concentration_min
O2_concentration_min=Simulink.Parameter;
O2_concentration_min.Value=[8];
O2_concentration_min.DataType='int8';
%O2_concentration_max
O2_concentration_max=Simulink.Parameter;
O2_concentration_max.Value=[14];
O2_concentration_max.DataType='int8';
%soot_mil
soot_mil=Simulink.Parameter;
... |
%% Stelling 7
%
% Een functie kan null of meerdere output variabelen hebben.
%
Antwoord = 1;
|
%syms l1 l2 l3 m1 m2 m3
syms q1 real
syms q2 real
syms q3 real
syms g real
l1 = 4;
l2 = 3;
l3 = 2;
m1 = 20;
m2 = 15;
m3 = 10;
ic1 = 0.5;
ic2 = 0.2;
ic3 = 0.1;
%transformation matrices
trans01 = [cos(q1) -sin(q1) 0 0; sin(q1) cos(q1) 0 0; 0 0 1 0; 0 0 0 1];
trans12 = [cos(q2) -sin(q2) 0 l1; sin(q2) cos... |
function [ x,y ,xk, yk] = forw_kinematics(th_k, th_a, params)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
X_a = 0;
Y_a = 0;
L_a = params.La;
L_k = params.Lk;
x = L_a*cos(th_a) + L_k*cos(th_k + th_a) + X_a;
y = L_a*sin(th_a) + L_k*sin(th_k + th_a) + Y_a;
xk = L_a*cos(th_a);
yk = L_... |
%% Cyclic Tour
%%
set(0, 'DefaultFigurePosition', get(0,'screensize'));
clc; clear; close all;
addpath('provided_code');
%% Introduction
% For a circular structure we to define a different neighborhood function.
% We can just pad the array of the units with additional units on the
% sides:
%
% $$[9,10|1,2,3,4,5,6,\un... |
bin = 0.005;
filtWidth = 0.015;
pre = 0.2;
post = 1.0;
CD = @(r1, r2) ( nanmean(r1,1) - nanmean(r2,1) )./sqrt( nanvar(r1,[],1)+nanvar(r2,[],1));
for i = 1:numel(Smd_mix)
R1sound= Smd_mix(i).SpikeTimes_R1_sound;
R2sound= Smd_mix(i).SpikeTimes_R2_sound;
[spikeRateR1C1,errorBounds,spikeMatR1... |
function [M] = wmean(X,lat)
%WMEAN Weighted mean value from global data
% Given spatial, global or hemispheric data, this function computes the
% weighted global mean value defined by:
% mean = sum(weights.*data)/sum(weights)
%
% wmean(X,lat) takes the weighted mean of 'X' according to the given
% latit... |
n=5; % no. of voice samples for each person
%if want to change n, also change in bpntrain and bpntest.
fs = 16000; % Sampling rate
intval = 3; % Recording time interval in seconds
len=fs*intval; %total length of voice sample
stime=0.015; %time duration in which voice is stationary
[fsize,osiz... |
function [X_poly] = polyFeatures(X, p)
%POLYFEATURES Maps X (1D vector) into the p-th power
% [X_poly] = POLYFEATURES(X, p) takes a data matrix X (size m x 1) and
% maps each example into its polynomial features where
% X_poly(i, :) = [X(i) X(i).^2 X(i).^3 ... X(i).^p];
%
% You need to return the following var... |
format shortG
clc
clear all
% Grid values constructed by value iteration
values = createGrid();
num_points = size(values,1)*size(values, 2);
% Order of polynomial to fit to grid values
polynomialOrder = 8; % Change this to desired order (max 7)
numberOfTerms = [3, 6, 10, 15, 21, 28, 36, 45];
row = 1;
F = zeros(num_p... |
function [f_IHT,f_IHTWS,f_admm,time_IHT,time_IHTWS,time_ADMM,card_IHT,card_IHTWS,card_admm,e1,e2,e3,KKTres_admm,rho_admm,time_rhomax,ratio] = Algorithms4(n,A,b,gamma,S,V,xstar)
%% Iterative Hard Threshold
epsilon = 1e-6;
Lambda = sqrt(max(diag(S)));
v = b/(1.1*Lambda);
Phi = A/(1.1*Lambda);
lambda = gamma/((1.1^2)*(Lam... |
function outp = resample(this, inp, range, nDraw, varargin)
% resample Resample from a VAR object.
%
% Syntax
% =======
%
% Outp = resample(V,Inp,Range,NDraw,...)
% Outp = resample(V,[ ],Range,NDraw,...)
%
% Input arguments
% ================
%
% * `V` [ VAR ] - VAR object to resample from.
%
% *... |
function phcllpvlt(varargin);
% phcllpvlt( [...] );
% LPV Laser T
h = timeplot({'ILTE7R7T'}, ...
'LPV Laser T', ...
'Laser T', ...
{'ILTE7R7T'}, ...
varargin{:} );
|
global GUI
global H
global XStimParams
global FN
sp_AM_pos_incr = 20;
sp_AM_tot_ht = 0;
sp_AM_ind_ht = 20;
sp_AM_Two_source_wd = 300;
sp_AM_Two_source_ht = 900;
% define figure
H.setparamsfig_AM = figure('Units', 'pixels',...
'Position', [10 100 sp_AM_Two_source_wd sp_AM_Two_source_ht], ...
'Name',... |
function [screenIndex] = taskScreen(taskParam, texture, screenIndex, txt)
%TASKSCREEN This function indicates the current task
%
% Input
% taskParam: structure containing task parameters
% texture: texture of image that is shown on the screen
% screenIndex: indicates current sceen of instruction p... |
function [tmpStitch, leftCoords, topCoords, tiles] = stitchScanMM(inDir, outDir, outFileName, scanDim, channel, contrastValues, resizeFactor, saveStitch)
% inDir is path to find the scan image files and transform_coords.mat. (e.g.
% '/Volumes/Blemert11/20191223_TM31_PLXtimecourse/plate3/wellA1/)
% outDir is... |
function[z_mean,ztot] = opti1(data)
ztot = data.shapes;
num = 56;
numset = 40;
z_mean = ztot(:,:,1);
z_mean = z_mean - sum(z_mean,2)/num;
z_mean = z_mean/norm(z_mean);
ztot = ztot - sum(ztot,2)/num;
ztot = reshape(ztot,[112,40]);
temp1 = vecnorm(ztot,2,1);
temp2 = repelem(temp1,112,1);
ztot = reshape(ztot./temp2,[2,... |
function [FM, i] = generate_lambdaFM(densities,N)
% densities - contains the FM densities of the sources
% N - contains the number of sources
% FM - cotains the final Fuzzy Measure values i.e. the whole lattice values
% i - contains the combinations at each level
%% define the lambda-fuzzy measure equation
syms x... |
path = [50.555744188142 9.679967612028123;
50.55580553499353 9.67993810772896;
50.55583024411951 9.679987728595735;
50.55584217265845 9.680019915103914;
50.55585836138502 9.6800534427166;
50.555802126837214 9.680129885673524;
];
%plot(path(:,1),path(:,2));
x=zer... |
function [ Z ] = ADMM_Vector( Dc ,Xc, lambdaHat, rho, ZPrevious)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
% batchSize = 1000;
% Z = rand(size(Dc,2),size(Xc,2));
% W = Z;
% U = rand(size(Dc,2),size(Xc,2)); % Change to appropriate value
Z = ZPrevious;
W = Z;
U = zeros (size(W));... |
testData = zx(301:end, :);
testLabel = y(301:end, :);
dataNum = size(testData, 1);
rightNum = 0;
for i = 1 : dataNum
ui = finalW * testData(i, :)' - b;
if ui < 0 && ( testLabel(i) == -1)
rightNum = rightNum + 1;
elseif ui >0 && ( testLabel(i) == 1)
rightNum = rightNum + 1;
... |
function [pc,ev,n_dim] = ComputeFromCov(sigma,n_data)
%COMPUTEFROMCOV Summary of this function goes here
% Detailed explanation goes here
[pc,ev] = myGPCA2(sigma,n_data,0,0);
n_dim = length(ev);
end
|
function [L,S] = tgvnn(input)
% Low rank and sparse based reconstructions using primal-dual algorithm
% min_{L,S} = (1/2)*||A(L+S)-B||_F^2+3DTGV(S)+beta*||L||_*
%
% input:
% B: undersampled data
% A: smapling operator
% AT: inverse sampling operator
% alpha: for TV
% beta: for nuclear norm
% maxits: no. of iteration
%
... |
function Ipcrop=plate_segmentation(img)
% [filename,pathname]=uigetfile({'*.jpg'});
% global FILENAME %定义全局变量
% FILENAME=[pathname filename];
% img=imread(FILENAME);
img=imresize(img,[140,440]);
figure(50);imshow(img);title('处理前')
Ipbw=border_removal(img);
Ippcrop=double(Ipbw);
figure(51);imshow(Ippcrop);tit... |
function out = UP_skin_segmentation(frame)
%UP_skin_segmentation removes useless details from frame returning an image
%where only skin is enlightened.
%Computation is done by checking at RGB and HVS frame values.
%
%
% OUTPUTS:
% * out - RGB containing only segmented hands. Useless details are make
% BLACK ([0,0... |
function [ posBubbles, volume ] = getPosBubbles(Nbubbles, L, type)
% function [ posBubbles, volume ] = getPosBubbles(Nbubbles, L, type)
% returns the bubbles in a domain that is either a cube or a sphere
%
% INPUTS:
% Nbubbles : the number of bubbles in the system
% L : the size of system in one dimension (diameter in ... |
% saveProcess = false;
% classification_offset;
% saveProcess = true;
%% Tuning parameters
range_parameter = 10:1:30;
range_threshold = 0.5:0.01:0.9;
nrows = length(range_parameter);
ncol= length(range_threshold);
windowCorrect = [0 3];
[alpha_movinAverage,beta_movinAverage] = meshgrid(range_parameter,range_thresh... |
function [cyto,PM,zap_ave,ratio]=single_cell_PM_cyto_ratio_auto(input_Tiff_movie)
% load the image;
%TCR=load_separate_chanel('TCR.tif');
file = input_Tiff_movie;
[zap70,TCR,Lck]=load_all_channels(file);
image_dim=size(zap70);
frame_number=image_dim(3);
% combine the 3 z stack in each channel to 1 frame;
fo... |
function femwind_bench_test
disp(' convergence speed test')
p=femwind_main
p.graphics=0;
p.sc_all = [1 2];
p.sc2_all = [2 4 8 16 32];
p.save_files=3;
p.levels=6
p.save_file_prefix='bench_6levels';
p=femwind_main(p);
end
|
function RecordingWork(channels,scanrate,nscans,buffersize,trigger,gain,npix,axH,textH,usrhdr,filename)
% RecordingWork(channels,scanrate,nscans,buffersize,trigger,gain,npix,axH,textH,usrhdr,filename)
% The real version is a MEX file
% channels = vector of channel #s (0-63), in the scanning order
% scanrate = number of... |
xN = 2^13;
dx = 2*pi/xN;
x = linspace(dx,2*pi,xN)';
compute_finite_differences_init(xN,dx,2);
global D
y = cos(x);
Dy = zeros(xN,1);
Dy(1) = (y(end-1)-4*y(end)+6*y(1)-4*y(2)+y(3))*dx^-4;
Dy(2) = (y(end)-4*y(1)+6*y(2)-4*y(3)+y(4))*dx^-4;
for i = 3:xN-2
Dy(i) = (y(i-2)-4*y(i-1)+6*y(i)-4*y(i+1)+y(i+2))*d... |
if player == 'b'
die(1) = 1 + floor(6*rand); % First die roll
die(2) = 1 + floor(6*rand); % Second die roll
die(3) = 1 + floor(6*rand); % Third die roll
sound(o4,Fs4) % Die rolling sound effect
bScore % Displays the score(s) on the die/dice
if die(1) == 6 & die(2) =... |
classdef CTY_exe_exported < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
TabGroup2 matlab.ui.container.TabGroup
ControlPanelTab matlab.ui.container.Tab
... |
y = 1:100;
x = randsample(5, 100, true);
k = x;
w = randsample(5, 100, true);
q = randsample(5, 100, true);
e = randsample(5, 100, true);
figure;
plot(y,x,'ko', 'MarkerSize', 4, 'MarkerFaceColor', 'r');
hold on;
grid on;
grid minor;
plot(y,w,'ko', 'MarkerSize', 8);
hold on;
ylabel('Selected precoder index');
xlabel('... |
%% Stelling 13
%
% De afmetingen (dimensies) van een vector v = [3 3 3 3]
% zijn 1 bij 3.
%
Antwoord = 0;
|
function [frecuencias, freordenada] = cripto_ana_orden(v)
numeros = letranumero(v);
frecuencias = zeros(27,2);
for i = 1:27
frecuencias (i,2) = i-1; % asignamos las letras
end
len = size(numeros);
for i = 1:len(2)
frecuencias(numeros(i)+1,1) = frecuencias(numeros(i)+1,1)+1; % con esto asignamos el numero d... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Technische Universität Berlin
% Fakultät Verkehrs- und Maschinensystem
% Fachgbiet Kraffahrzeuge
% M.Sc. Osama Al-Saidi
%
% Fahrzeugregelung: Übung - Einführung in Matlab/Simulink
% Aufgabe: Einheitssprung
% Datum: 21.10.2014
%
%... |
function [W,b] = myintialize(m,n,a)
W = a*randn(m,n);
b = a*randn(m,1);
end
|
% [LogL,mog] = em_mog(X,C,verbose);
%
% Parameters are:
% X (N x D) : data matrix
% C : number of mixture components
% verbose : verbosity (1 prints info, 2 prints and draws)
%
% Jakob Verbeek (University of Amsterdam)
% http://www.science.uva.nl/~jverbeek
%
% Modified Oct 2008 Gwenn Englebienne
func... |
function irr = ipt(f,ff)
%CHECK IF A POLYNOMIAL IS IRREDUCIBLE
[p,n] = ff.gfgetpn(ff);
q = p^n;
l = length(f)-1;
h = ff.rem(ff,[-Inf 0],f);
for k = 1:floor(l/2)
acum = ff.one;
for l = 1:q
acum = ff.prod(ff,acum,h);
end
h = ff.rem(ff,acum,f);
g = ff.minus(ff,h,[-Inf 0]);
gcd = euclid_u(... |
% This function is used for pre-processing of the sound files
% pre-processing involves following steps
%
% 1. Windowing
% 2. Pre-emphasis
function [p_data] = pre_process(x)
% x : input signal (could be in rows of frames i.e. row1 = frame1)
% applying window on each frame
[r,c] = size(x);
for i = 1 : r
x1(i,:) = x... |
import matlab.unittest.TestSuite
import matlab.unittest.TestRunner
import matlab.unittest.plugins.CodeCoveragePlugin
suite = TestSuite.fromFolder('test');
runner = TestRunner.withTextOutput;
runner.addPlugin(CodeCoveragePlugin.forFolder(string(pwd) + filesep + "code"))
result = runner.run(suite);
% Note where the re... |
function [Data]=FabricTensorDebug(spheres,FileOutFlag,figflag)
% Function FabricTensor.m takes an image stack with cross sections parallel
% to the snow surface and performs 3-D segmentation finding bonds and grain
% pairs.
%
% INPUTS:
% Code requires input of an image stack with sequential numbering of
% binari... |
% DDENCMP 雑音除去または圧縮処理に関連したデフォルト値の算出
%
% [THR,SORH,KEEPAPP,CRIT] = DDENCMP(IN1,IN2,X) は、ウェーブレットまたは
% ウェーブレットパケットを使って、1次元の入力ベクトル信号または2次元の
% 入力行列信号の雑音除去または圧縮に対するデフォルト値を出力します。
% THR はスレッシュホールド値、SORH はソフトスレッシュホールドまたは
% ハードスレッシュホールドの指標、KEEPAPP は Approximation 係数を処理するか
% どうかの設定、CRIT (ウェーブレットパケットに対してのみ用いられます) は、
% 使用するエントロピー... |
function y = sinc2(x, wc)
y = sin(wc*x)./(pi*x);
y(x==0) = wc/pi;
end |
function [ROC_pval_PCA_Inception, ROC_pval_PCA_simple, ROC_pval_Inception_simple] = ...
ROC_all( task, fast, nn_simple, nn_inseption, channel_type, PCA_channels_type)
%UNTITLED plot ROC curves
%==========================================
%Author: Uladzislau Barayeu
%Github: @UladzislauBarayeu
%Email: uladzislau.ba... |
function rad_bunch_data=rad_mat_bunch(scanner,input,rad_options)
% RAD_MAT_BUNCH(scanner,input)
% input is either
% 'Name.list', the list file on the scanner(like radish_scale_bunch).
% OR the parameters to list maker.
% 'runno study series count'
% 'runno study series count first_num
% look at radish_scale... |
function [ fext ] = getInitialFunction( obj )
fext = cell( obj.Nmesh, 1 );
for m = 1:obj.Nmesh%Íø¸ñÑ»·
fext{m} = zeros(obj.meshUnion(m).cell.Np, obj.meshUnion(m).K, obj.Nfield);%´óСNp*K*Nfield
a = obj.meshUnion(m).x;
b = obj.meshUnion(m).y;
[ h, u, v ] = getInitialRossbyWave(obj, obj.meshUnion(m), a,... |
%Name: Matlab: Signals and Systems Lab 6th
%Auther: Changgang Zheng
%Student Number UESTC:2016200302027
%Student Number UoG:2289258z
%Institution: Glasgow College UESCT
%Question: 4.5(b)
function problem_3rd
a1=[1 3/2 1/2];
b1=[1 -2];
[r1,p1]=residue(b1,a1) |
%以下是关于逆运动学求解并对角度误差分析的程序
function[] = IKSolver_lineanalyse(delta)
tic
%m为第几个关节角1-6 delta为加的角度误差值 0.1 or 0.2
qd = [0.5;0.5;0.5;0.5;0.5;0.5]; %只用做建立位置用
q0 = [0;0;0;0;0;0]; %初始位置去逼近
%程序正式开始 --------------
Td = FKSolver(qd); %产生一个初始位姿Td
m = 1:1:28;
distance = -0.03;
qd_delta1 = q0;
qd1= zeros(6,28);
... |
function result = readvol(name)
%
% function result = readvol(varargin)
% Luis hernandez
% last edit 6-1-2001
%
%
% The function returns a 3D array
% of dimensions determined by the header
% dim x dim x no_slices
% Let user select filename ...
if nargin==0
[file path] = uigetfile('*.img','Select Analyze fil... |
function plot_contour (xx,conec,in,eltype,tline)
inn = zeros(max(in),1);
inn(in(:)) = 1:length(in);
[nElem,npe] = size(conec);
if (eltype == 5);
npe = npe-1;
end
X = zeros(npe+1,nElem);
Y = zeros(npe+1,nElem);
x = zeros(size(xx,1),1);
y = zeros(size(xx,1),1);
for k = 1:npe,
X(k,:) = xx(inn(c... |
%% Calculate pixel to meters conversions
%Need "masterData" loaded
nestBackIm = masterData(1).colonyData(1).nestBackIm;
forBackIm = masterData(1).colonyData(1).forBackIm;
%% calculate conversion factors for nest images
%Conversions are expressed in mm/pixels
%Nest image reference distances:
%width of nest rectangle... |
function [peakGammaFreq, peakHarmonicFreq, gammaAmp, harmonicAmp, GHfreqRatio, GHampRatio, GHampRatioExact, harmonicAmpExact] = findGammaPeak(BLcorrectedPSD, freqVals, gammaRangeHz, deltaF)
if ~exist('gammaRangeHz','var'); gammaRangeHz =[30 70]; end
if ~exist('deltaF','var'); deltaF = 12; end
gammaRa... |
%{
tp.Cos2Map (computed) # my newest table
-> tp.OriMap
-----
cos2_amp : longblob # dF/F at preferred direction
cos2_r2 : longblob # fraction of variance explained (after gaussinization)
cos2_fp : longblob # p-value of F-test (after gaussinization)
pref_ori : longblob # (radians) preferred direction ... |
%Quantization function
function y= quant(x,L,a,b)
%assigning zeros to vector y
y=zeros(size(x));
%running variable n from 1 to L
n=1:L;
%generating levels
lvl=a+(b-a)*(2*n-1)/(2*L);
for i=1:length(x)
diff = b-a; p = 1;
for j=1:length(lvl)
if abs(x(i)-lvl(j))<diff
... |
classdef NeuritesAnalyser
properties
I
Iroi
rbw
gbw
maskedR
maskedG
Segments
Synapses
end
methods
function obj = NeuritesAnalyser(rgbimg,roi,R,G)
if (ischar(rgbimg))
obj.I = imread(rgbimg);
else
obj.I = rgbimg;
... |
%% Declaration of Authoriship
% This code was written Jason K. George
% for the purpose of his final year project at Stellenbosch University
% in partial completion for the subject Project (E) 448
%% Code
close all
generate_plot(1, 30);
% generate_plot(1, 10);
% generate_plot(1, 30);
% generate_plot(1, 45);
% generat... |
%---------------------------------------------------------------------
% sosoptdemo2
%
% Demonstration of SOSOPT function for solving sos optimizations.
% This example uses SOSOPT to find a Lyapunov function for a three
% state rational system.
% See SOSOPT help for more details on the function syntax.
%
% Reference: ... |
cd F:\program\QOS\qos
addpath('F:\program\QOS\qos\dlls');
import qes.hwdriver.sync.*
%%
idc = ustc_dc_v1([1,2,3,4]);
dcSrc = dcSource.GetInstance('usct_dadc',idc);
dcChnl1 = dcSrc.GetChnl(1);
dcChnl1.dcval = -32768; |
%% Sampling for only test
half = 2;
%% Load MNIST data
addpath('mnist');
X_tr = loadMNISTImages('train-images-idx3-ubyte');
X_te = loadMNISTImages('t10k-images-idx3-ubyte');
y_tr = loadMNISTLabels('train-labels-idx1-ubyte');
y_te = loadMNISTLabels('t10k-labels-idx1-ubyte');
%% Split
if 1 == half
X_tr = X_tr(:,1:3... |
% wait for the green key to be pressed and only continue if green has been pressed
keyIsDown = 0;
while ~keyIsDown
KbQueueStart(pptResponseDevice); % Perform some other tasks while key events are being recorded
[keyIsDown,secs, keyCode] = KbCheck(experimenterKeyboard); %checking computer keyboard
if ke... |
function [xs, elems, type, var_nodes, var_elems] = readvtk_unstr(filename)
%READVTK_UNSTR Read in a Legacy ASCII Visualization Toolkit file.
% [XS,ELEMS,TYPE,VAR_NODES,VAR_ELEMS] = READVTK_UNSTR(FILENAME) Reads
% Visualization Toolkit file, FILENAME.
%
% The output arguments are the coordinates of points in an nx3 matr... |
function varargout = centroid(varargin)
% This code takes an image (e.g. acquired with VMI machine) and determines
% the locations of electron (or ion) hits, and returns with the coordinates.
% The idea is to first threshold the image, and then sort the pixels with
% nonzero values into lists (or sets) based on top... |
function g = load_subset_detections(prefix,p,red,time_bounds,fig)
%
itime=find(p.time>=time_bounds(1) & p.time<=time_bounds(2));
d=p.file(itime); % files within the specified time
t=p.time(itime);
fprintf('Selected %i files in the given time bounds, from %i total.\n',...
length(d),length(p.time))
k=0;
for i... |
function X = uq_ks_invcdf( F, parameters,varargin)
% X = UQ_KS_INVCDF(F, parameters) calculates the inverse
% Cumulative Density Function values of CDF values F of samples X whose
% density was estimated from existing data by kernel-smoothing. This is
% achieved by interpolating the already existing values... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% calculates life time %
% utility in saving model %
%%%%%%%%%%%%%%%%%%%%%%%%%%%
function v = utilsum(s)
global betta T r w;
c = cons(s);
v = CRRA(c(T));
for t=(T-1):-1:1
v = CRRA(c(t)) + betta*v;
end
v=-v; |
function hc = cumulative_histogramme(I)
hc= compute_histogram(I);
for i=2:size(hc,1)
hc(i,1)=hc(i-1,1) + hc(i,1)
end
end
function h = compute_histogram(I)
% return a 256x1 matrix
h = zeros(256,1);
for i = 1:size(I,1)
for j = 1:size(I,2)
h(I(i,j) + 1, 1) = h(I(i,j) + 1, 1) + 1;
end
end
end |
temp = [0,0]
b = size(temp)
x = [1,2;2,3;4,5;]
temp = temp + x(1,:)
temp = temp + x(2,:) |
function class = genre_class(genre)
% Transforms a text description of a genre to a class label.
%
% Usage:
%
% CLASS = GENRE_CLASS(GENRE)
class = -1;
if strcmp(genre, 'punk')
class = 1;
elseif strcmp(genre, 'soul and reggae')
class = 2;
elseif strcmp(genre, 'metal')
class = 3;
elseif strcmp(genre, 'folk... |
function r = solo_get_session_duration(x)
%
% Returns time (in min) between end of last trial (after trimming!)
% and beginning of first trial (again, after trimming).
%
% x is a loaded-from-disk Solo file.
%
%
% Note that if Solo program crashed, any time during restarting,
% after crashing and before pressing run
... |
% ---------------------------------------------------------
% dynConstants
% ---------------------------------------------------------
% Dynalog Analysis Package
% Michael Hughes 2010-2011
% ---------------------------------------------------------
% Allows the user to specifiy constants used by other
% functions.
%
% ... |
function L = elbo(phi, Pi, beta, v, W, alpha0, beta0, v0, W0)
N = size(phi, 1);
D = size(W, 1);
K = size(Pi, 1);
L0 = gammaln(sum(alpha0)) - sum(gammaln(alpha0)) - gammaln(sum(Pi)) + sum(gammaln(Pi)) - (N * D * K * log(2 * pi)) / 2;
for k = 1: K
L10(k) = (-(v0 * D * log(2)) / 2) + ((v(k, :) * D * log(2)) / 2);
L1... |
function varSelDemo()
methods = {...
@(X,y) larsSelectSubsetCV(X,y, 'nfolds', 5), ...
@(X,y) fbmpCore(X,y,'maxNumSearches',5), ...
@(X,y) ARDwipf(X,y,'maxIter',50)};
methodNames = {'lars', 'bmp', 'ard'};
nmethods = length(methodNames);
n = 100;
ds = [50 150 200]; % 10:50:500;
sigma = 0.1;
sparsity... |
function [a] = checkersi(n)
a = max(0,(2*rem(1:n,2)-1)'*(2*rem(1:n,2)-1));
end
|
% t25 = csvread('2.5.txt',1,0,[1,0,NaN,0]);
% v25 = csvread('2.5.txt',1,1,[1,1,NaN,1]);
% i25 = csvread('2.5.txt',1,2,[1,2,NaN,2]);
%
% tr25 = csvread('2.5r.txt',1,0,[1,0,NaN,0]);
% vr25 = csvread('2.5r.txt',1,1,[1,1,NaN,1]);
% ir25 = csvread('2.5r.txt',1,2,[1,2,NaN,2]);
%% 1.0v Load Data
data1 = load('1.0... |
% create a 10 by 10 matrice
A = magic(10);
x = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10]
V = zeros(10, 1)
for i = 1:10
for j = 1:10
V(i) = V1(i) + A(i, j) * x(j);
end
end
display(V)
V1 = A * x
%V2 = Ax
V3 = A.*x
V4 = sum(A * x) |
clear all
clc
format long
options = odeset('RelTol', 1e-6, 'AbsTol', 1e-6);
%a se papper
L = 2.7;
tspan = [0 8];
u0 = [2*pi/7 0.7];
f = @(t,u) fun(t,u,L);
[tt uu] = ode45(f, tspan, u0, options);
u1 = uu(:,1); %vinkel
u2 = uu(:,2); %vinkelhastighet
subplot(3,1,1)
plot(tt, u1); grid on;
xlabel('tide... |
function id = appendhdf5dataset(filename,datasetname, data,dim, varargin)
opt.extendable = true;
opt.chunksize = [];
opt.truncate = false;
opt.ndims = [];
opt.fillvalue = NaN;
if (isstruct(filename))
id = filename;
init = false;
else
id = struct('file',[]);
init = true;
end;
if (isempty(datasetname))
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.