text stringlengths 8 6.12M |
|---|
clc;
clear;
close all;
global epsilon;
global del;
global F;
del=-2;
F=2.477;
epsilon=0.1;
figure(1)
axis([-10,10,-10,10]);
axis 'manual'
op = odeset('reltol',1e-7,'abstol',1e-9);
for k=1:10
grid
x=ginput(1);
[t,y]=ode45('entrain',[0,100],x,op);
plot(y(:,1),y(:,2),'HandleVisibility','off');
... |
%% STEP 1 - Get video file
% Get video for analysis
[videoInfo.filename, videoInfo.pathname] = ...
uigetfile('*.mp4;*.avi','Pick a video file');
addpath(genpath(videoInfo.pathname))
videoFile = VideoReader(videoInfo.filename);
displacementS = displacementSS
%% STEP 2 - Look through frames/regions of interest
imp... |
function [ data ] = GetSingleInput( filename )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
% Output data 1 by 15
C = textread('1ZoneEvapCooler.idf','%s','delimiter', '\n');
data(1) = str2double(regexp(C{182},'(\d+.+\d+\d)','match'));
data(2) = str2double(regexp(C{183}... |
function [res] = state_beta_bootfn(d,s0,s1,xi,WINDOW)
% boot function used in bootstrap_runs_in_beta.m to bootstrap the P(state1 = non-persistent| state0 = persistent)
% d = distance run started from aggreagte (T.Dn1)
% s0 = state0 (T.state0)
% s1 = state1 (T.state1)
% xi d points at which to calculate the probability
... |
function [ z ] = fslope(x, y, Dire, Slope)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
switch Dire
case 1
z = -(Slope/4)*0.4 * x -(Slope/4)*0.0 * y; % [0.4 0 1]
case 2
z = -(Slope/4)*0.3 * x -(Slope/4)*0.1 * y; % []
case 3
... |
%Testing Forward and Inverse Kinematics
syms Thelta
L2 = 5
Lep= 3
Tx = 4
Ty = 3
Tz = 1
Thelta = IKSolve(L2,Lep,Tx,Ty,Tz)
% thel = IKCal(L1,L2,Lep,Tx,Ty,Tz)
PEE = DirectFK(L1,L2,Lep,Thelta(1),Thelta(2),Thelta(3))
|
% Solve an Input-Output Fitting problem with a Neural Network
% Script generated by Neural Fitting app
% Created 14-Jul-2017 00:58:02
%
% This script assumes these variables are defined:
%
% input - input data.
% output1 - target data.
x = input';
t = output1';
% Choose a Training Function
% For a list of all tra... |
function fig = ghclptrh(varargin);
% ghclptrh(...)
% PTRH
ffig = ne_group(varargin,'PTRH','phclptrhs');
if nargout > 0 fig = ffig; end
|
function [O] = jpegEncoder(I)
%% PROBVECTOR - finds the Probability of each intensity levels present in the image (I).
% Input
% I - Input Image
% Output
% O - JPEG encoded values
%% The Function starts here
% Level shift image by 2^(m-1)
I = double(I) - 128;
[M , N ] = size(I);
imshow(I);
imwrite(I... |
% Enumeration for the exit type (code) for the inverse dynamics
%
% Author : Darwin LAU
% Created : 2014
% Description :
classdef IDSolverExitType
enumeration
NO_ERROR
INFEASIBLE
ITERATION_LIMIT_REACHED
SOLVER_SPECIFIC_ERROR
OTHER_ERROR
end
end
|
function [permu,mini,liste_delta] = permutation(chemin, mat_tabou, mat_dist)
%Cette fonction permet de faire des permutations pour voir celle qui offre
%un chemin qui minimise le coût.
% d la distance totale actuelle
d = total_distance(chemin, mat_dist);
% on stocke le chemin d'origine
chemin_origine = chemin;
% On fa... |
function e_VarAux = f_eVarAuxInic(xx,e_DatSet,e_VG)
%Las variables auxiliares son variables que se utilizan para pasar valores entre la funciones y
%que pueden variar en cada iteración. Distinto a las variables históricas que se mantiene dos
%copias de las mismas (old y new), en esta se mantiene el valor ... |
function image_with_replaced_entries = ...
Replace_nan_entries( image_with_nan , scalar_replacement )
%Replaces the nan of the image with the scalar replacemnt - design for
%images genrated by interpolation
%The input is the image with nan vaules and the scalar replacement
%The output is the image with the... |
function out = my_local_contrast(in, window_size, gauss_std );
% Performs a local contrast enhancement using a gaussian smoothing function
% of specified size and standard deviation and uses mirror padding to treat border effects.
%
% Required Input Parameters: in - chest X-ray image (double precision format).
% window... |
%%% This function is different from stft_multi() by
%%% no zero padding before the signal data, thus the frame number is less by 1.
function X=stft_multi_2(x,wlen)
% STFT_MULTI Multichannel short-time Fourier transform (STFT) using
% half-overlapping sine windows.
%
% X=stft_multi(x)
% X=stft_multi(x,wlen)
%
% Input... |
function [success] = saveNwbMovie(inputData,fileSavePath,varargin)
% Saves input matrix into NWB format output file.
% Biafra Ahanonu
% started: 2020.05.28 [09:51:52]
% inputs
%
% outputs
%
% changelog
% 2021.08.10 [09:57:36] - Updated to handle CIAtah v4.0 switch to all functions inside ciapkg package.
%... |
function [cdf_scatter,petzold_angle_rad] = generate_scatter(func_type,water_cond,g)
if strcmp(func_type,'')
func_type = 'measured';
end
if strcmp(water_cond,'')
water_cond = 'clear';
end
%func_type = 'calc' % 'measured' or 'calc'
% % g = 0.924;
% % GENERAL USAGE:
% % [cdf_scatter,angle] = generate_... |
clear all;
pi=3.1415926;
epsilon=10;
phis=[0.26, 0.28,0.30,0.32,0.34,0.36,0.38,0.40,0.42,0.44,0.46,0.48,0.50,0.52,0.54,0.56,0.58];
periodPre=load('/home/xiaoling/SpiralWave/data/Spi7_n5_Period_t240.dat');
anchorPre=load('/home/xiaoling/SpiralWave/data/Spi7_n5_Anchor_t240.dat');
for i=1: length(phis)
period_i=peri... |
function myzoom
myDraw % draw original figure
while 1
try
% return 1 when pressing button;
% report error when close figure
if waitforbuttonpress
close gcf
break
end
catch
return;
end
[xlim,ylim,prect] = getbox; % captu... |
function ups = resample_decoder(img)
[h, w, d] = size(img);
nt = 2;
fp = 3;
ups = zeros(h*2, w*2, d);
for ch = 1:d
% wrap
img_wrapped = padarray(img(:, :, ch), [nt, nt], 'symmetric');
% resample
row_rs = resample(img_wrapped, 2, 1, fp);
img_ups = resampl... |
%cache variables
x=[];
y=[];
xlay= [];
ylay= [];
index=[];
%plots the figures for further processing
figure (f2);
figure (f3);
%zoom image
zoom on;
pause() % zoom with your mouse and when the image is okay, press any key
zoom off; % to escape the zoom mode
ho... |
function [ distance ] = shots_distance( params, xleft, cleft, cright )
% TODO
%
% INPUT:
%
% INTERNAL PARAMETERS:
xright = -xleft; xend = 0;
xspan_left = [xleft xend]; xspan_right = [xright xend];
intervals = 2 ^ 10;
init_left = asympt_left(params, cleft, xleft);
init_right = asympt_right(params, cright, xright);
... |
%%%%%%%%%%%%%%%%%%% Testing graph loss function %%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% Parameters %%%%%
% 5 ERRGs, 5 GRGs
graphs = false(100,100,10);
r = zeros(100);
for i=1:5
r = rand(100);
g = r<.0125; %This gives an ER graph with ~p=.025
g = or(g,g');
g(logical(eye(size(g))))=0;
graphs(:,:,i)=g;
end... |
function GTinfo = getGT_1(name)
% this function stores the information about GT of the components. We know in the saved image we ssave the image in the following
% format. "sorted index_image number_component number"
% initially we mannualy checked each image and get to know that which
% images are having the right ma... |
%Binomial QWT design
%Works only for single value of th and ph (I guess, not defining Z values
%considering th, ph)
function [ZA, Z, erZ, h, Zp] = binomialImped(ZL, Z0, N, er, th, ph, freq, fr0)
c = 3e8;
lam = c./freq;
k = 2.*pi./lam;
lam0 = c./fr0;
% k0 = 2.*pi.*fr0./c;
Z = zeros(N, length... |
function rounded=floorToMultipleOf(x,divisor)
%Rounds the first input argument to the closest multiple of the second
%argument.
rounded=floor(x/divisor)*divisor;
end |
%% Initialization
U = load('traces.mat');
G = U.G;
Tr1 = U.Tr1;
Tr2 = U.Tr2;
k = 50; % graph size
pi_0 = [1 0 0 0 0 0 0];
Q = getQTeleport(G, 0.5);
n = 20; % number of traces
m = 5000; % trace size
%% Quadratic error test
lambda = 1;
X = zeros(n,m); % traces
Q_est = zeros(n,k,k); % Q per graph
E = zeros(k,k); % q... |
%% Tabulate homopolymers in human genome
clear;
chrpath = 'C:\Users\MarkPratt\Documents\Genome\hg38\chroms';
chrStr = {'1' '2' '3' '4' '5' '6' '7' '8' '9' '10' '11' '12' '13', ...
'14' '15' '16' '17' '18' '19' '20' '21' '22' 'X' 'Y' 'M'};
imap(int16('ACGTacgtNn')) = int8([0 1 2 3 0 1 2 3 7 7]);
cmap = 'ACGT'; ... |
% new matlab file for using revision control
disp('Keith makes a change') % »» comment by KF 2017-04-26 09h37:
sprintf('Hello World: This file is made using MATLAB...\n') |
function Y = asec(X)
% Symbolic inverse secant.
% Convert inputs to SymExpression
% X = SymExpression(X);
% construct the operation string
sstr = ['ArcSec[' X.s ']'];
% create a new object with the evaluated string
Y = SymExpression(sstr);
end
|
function [net, error] = PaternRecogFeedford_Neural_Network(data, numCoeff, lossfunction, networkTopog)
%Sort out data
dataSize = size(data, 2);
r = randperm(dataSize);
class = zeros(1,dataSize);
for i = 1:dataSize
a = data{2,i};
class(1,i) = a;
end
NeuralDataValues = zeros(numCoeff, dataSize);
NeuralD... |
function c_SaveObjCallback(obj,hObject, eventdata, handles)
SpIm = obj;
uisave('SpIm');
end |
function N = negativo(I)
[y, x] = size(I);
N = zeros(y,x);
for i = 1:y
for j = 1:x
N(i,j) = 255 - I(i,j);
end
end
N = uint8(N);
end |
% calculate rate of H + O2 + M -> HO2 + M
% Updated 7/18/06 AEP
% Based on JPL Data Evaluation #15
% rate=kHO2(T,M)
function j=kHO2(T,M)
k9o=4.4e-32.*(T./300).^(-1.3).*M;
k9oo=4.7e-11.*(T./300).^(-0.2).*M;
k9=(k9o./(1+(k9o./k9oo))).*0.6.^((1+(log10(k9o./k9oo)).^2).^(-1.0));
j=k9;
|
function H = circle(center, radius, NOP, style)
%---------------------------------------------------------------------------------------------
% H=CIRCLE(CENTER,RADIUS,NOP,STYLE)
% This routine draws a circle with center defined as
% a vector CENTER, radius as a scaler RADIS. NOP is
% the number of points on the ... |
%{
reso.OriMap (imported) # responses to directions of full-field drifting gratings
-> reso.OriDesign
-> reso.VolumeSlice
---
ndirections : tinyint # number of directions
regressor_cov : longblob # regressor covariance matrix, nConds x nConds
re... |
%% UNIVERSIDADE FEDERAL DO CEARÁ
% CAMPUS SOBRAL
% CURSO DE ENGENHARIA DE COMPUTAÇÃO
%
% INTELIGENCIA COMPUTACIONAL - TRABALHO 02
%
% ARTHUR SOUSA DE SENA MATRICULA: 345750
% VICTORIA TOME OLIVEIRA MATRICULA: 366333
% VITORIA ALMEIDA BERTAIA MATRICULA: 356741
%% PROBLEMA ====================... |
%% volatility and hedging error study 1
% 黄勉 20160202,参考 Jim Gatheral PPT volatility and hedging error 1999
% 验证如下结论
% If the market is range bound, hedging a short option
% position at a lower vol. hurts, and we need to use large vol.
% If the market is trending, hedging a short option
% position at a higher vol. hur... |
function y = pochhammer(x,n)
% pochhammer(x,n) returns the rising log-factorial log(gamma(x+n)/gamma(x))
% Named after the corresponding Mathematica function.
%
% pochhammer.c provides a faster implementation.
if 0 && length(x) == 1 && all(n < 100)
nmax = full(max(max(n)));
t(1) = 0;
y = 0;
for i = 1:nmax
... |
function plot_rician_noise_scale_across_scans(Enhancement_Noise_Struct)
Scan_IDs = {Enhancement_Noise_Struct.Scan_ID};
Scan_Dates = extract_scan_date_from_scan_id(Scan_IDs);
[Scan_Dates, sort_idx] = sort_scan_dates(Scan_Dates);
Enhancement_Noise_Struct = Enhancement_Noise_Struct(sort_idx);
rician_scale = [Enhancemen... |
function spcout = spc_calcBinning(spc)
xw = spc.size(2);
yw = spc.size(3);
%imageMod = reshape(full(spc.imageMod), spc.size(1), xw, yw);
spc.imageMod = spc.imageMod(:,1:2:xw,1:2:yw) + spc.imageMod(:,2:2:xw,1:2:yw)...
+ spc.imageMod(:,1:2:xw,2:2:yw) + spc.imageMod(:,2:2:xw,2:2:yw);
spc.size(2)=round(spc.size(2)/2);... |
clear
fs = 48828;
upperF = 1000;
Point_dur = 1/upperF;
mseq = mls(11,0);
mseqIAC = [];
for i =1:length(mseq)
mseqIAC = [mseqIAC ones(1,round(Point_dur*fs))*mseq(i)];
end
RealUpperF = fs/round(Point_dur*fs);
nn = randn(1,length(mseqIAC))
nn(2,:) = nn(1,:) .* mseqIAC;
t = 0:1/fs:length(mseqIAC)/fs - 1/fs;
figu... |
function [data, L, K, snm_draws] = ar1_model(theta, modelargs)
snm_draws = modelargs{1};
simlength = modelargs{2};
burnin = modelargs{3};
make_instruments = modelargs{4};
if ischar(snm_draws)
snm_draws = randn(simlength + burnin + 10, 2);
modelargs{1}= snm_draws;
endif
n = modelargs{2};
maxlag = 1;
n = n ... |
function filtsig = butfilt(sig, Fcp, Fsp, order)
% Fcp=200; %cutoff frequency
% order = 2;
% Fsp = 20000;
[z,p,k]=butter(order,Fcp/(Fsp/2),'high');
[sos,g] = zp2sos(z,p,k);
filtsig=filtfilt(sos,g,sig);
end |
% function show_photo_on_color_map
% Provide a photo and color map. This program provides a "heatmap"
% showing which colors the photo uses, and how often.
clear
clc
%%
addpath('C:\Users\Daniel\Desktop\PAINTERS_COPILOT\') % for access to color_difference.m
%% Inp... |
function mrk = tl_mrk_selectTrials(mrk,ind_sel,incell)
% Select a subset of trials from all existing trials. Best used in
% combination with tl_mrk_analyzeTrials in order to generate a conditional
% selection.
%
% Input:
% mrk - Marker structure as returned by tl_proc_loadData
% ind_sel - Either a logical vect... |
% ------------------------------------------------
% Pre processing pipeline author: Davide Gheza
% (Gambling Task Redos)
% with filtering, ICA on continuous data
% ------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pt. 3/3 %%%%%%%%%%%%%%%%%%%%... |
function label = chain_conll_oracle(param, model, xi, yi)
% Do loss-augmented decoding on a given example (xi,yi) using
% model.w as parameter. Param is ignored (included for standard
% interface). The loss used is normalized Hamming loss.
%
% If yi is not given, then standard prediction is done (i.e. MAP decoding
% w... |
format long;
% Samples:
%% 1:
% 1.1 = 7.7064
% 1.2 = 18.102
% 1.3 = 10.333
% 1.4 = 7.7428
% 1.5 = 7.7221
%f=@(x)x^3+x^2+sin(x);
%F=@(x)x^4/4+x^3/3-cos(x);
%a=-1;
%b=2;
%% 2:
% F: 12.82
% HT: 11.26
% HTMR: 12.57
%f=@(x)0.3+20*x-140*x^2+730*x^3-810*x^4+200*x^5;
%a=0.2;
%b=0.8;
%% 3:
% F: 0.8821
% SS13MR, n=4: 0.8... |
function [ ] = DisplayPerm_FM(Perm)
%[ ] = DisplayPerm_FM(Perm)
printf(' Plaintext Ciphertext \n \r')
printf('===============================\n\r')
for k=0:25
CtextInt = Perm(2, k+1)-1;
printf(' %s %s \n\r', char(97+k), char(65+CtextInt));
end;
|
function [ DownwindedTermX ] = matCalculateDownwindedFphysDerivative(obj, mesh, fphys, physClass, variableX )
% Note: this function is only used for the calculation of the second order
% derivative of (H+2z)
InnerEdge = mesh.InnerEdge;
[fm, fp] = InnerEdge.matEvaluateSurfValue( fphys );
[vfmx, vfpx] = InnerEdge.matEval... |
function results = uq_PCE_omp(univ_p_val, current_model)
% UQ_PCE_CALCULATE_COEFFICIENTS_OLS(MODULE): calculate via Orthogonal
% Matching Pursuit regression the polynomial chaos coefficients with the
% options specified
% initializing the output status to 0
success = 0;
% let's check the model is of type "uq_metamo... |
Ylm=simresult.Ylm_red;
amps=zeros([size(Ylm,2) size(Ylm,3) size(simresult.amps0,4)]);
for indJstate=1:size(simresult.amps0,4)-1
for indJ=1:size(Ylm,2)
for indM=1:min([indJ size(Ylm,3)])
if indJ==indJstate
if indM==1
amps(indJ,indM,indJstate)=1;
... |
% Finite difference method for 1D Fisher's equation BIVP
% Explicit scheme
% Grid end points
x_begin = 0;
x_end = 1;
t_begin = 0;
t_end = 1;
% Time & space step
dt = 0.01; % time
dx = 0.2; % space
J = x_end/dx;
N = t_end/dt;
mu = dt/(dx^2); % In this case, stability condition is relaxed a little, howe... |
function createAreaDist(X1, ymatrix1)
%CREATEFIGURE1(X1, YMATRIX1)
% X1: area x
% YMATRIX1: area matrix data
% Auto-generated by MATLAB on 05-Aug-2014 17:22:54
% Create figure
figure1 = figure;
% Create axes
axes1 = axes('Parent',figure1,...
'XTickLabel',{'60','100','200','300','400','500','600','700','800'... |
function cross_point=linecross(k1,b1,k2,b2)
x=[];
y=[];
if k1==k2&b1==b2
disp('all the line is cross_point');
elseif k1==k2&b1~=b2
disp('there is no cross_point');
else
x=(b2-b1)/(k1-k2);
y=k1*x+b1;
cross_point=[x y];
disp('The cross-point is');
disp(cross_point);
end |
baseDir = '~/workspace/DeepCNNData/cifar/';
rawDir = [baseDir, '/raw/'];
outDir = [baseDir, '/formatted/'];
trainNames = {...
[rawDir, 'data_batch_1.mat']; ...
[rawDir, 'data_batch_2.mat']; ...
[rawDir, 'data_batch_3.mat']; ...
[rawDir, 'data_batch_4.mat']; ...
[rawDir, 'data_batch_5.mat']; ...
};
test... |
addpath('C:\Users\Max Yi Ren\Documents\Research\Code\Tools\');
addpath('C:\Users\Max Yi Ren\Documents\Research\Code\Tools\liblinear\matlab');
NQ = 50;
TEST = 12;
load basedata.mat;
%% check w convergence
% calculate w under all information
% A = bsxfun(@times,dX,2*(dX*w'>0)-1);
% A(abs(dX*w')<1e-3,:) = [];
%... |
clc;
clear all;
%% Datos
rE = 6378;
%% Apartado a
rp = rE + 600;
ra = rE + 36000;
ap = (ra + rp)/2
ep = 1 - rp/ap
pp = ap*(1-ep^2)
%% Apartado b:
mu_E = 3.986e5;
vp_p = sqrt( 2*mu_E/rp - mu_E/ap );
vp_imp = vp_p + 2.7;
energia = vp_imp^2/2 - mu_E/rp;
ah = -mu_E/(2*energia);
v_inf = sqrt( mu_E*( - 1/ah ) );
%% A... |
function y = dfdp(x,f,p,dp,func,Q)
%df/dp = dfdp(x,y,p,dp,func)
%
% Returns the partial derivatives of function 'func'.
% 'x'(vect) is x axis values, 'y' is y values, 'p' and 'dp' are parameters and
% their variation. 'func' is the function concerned (y=func(x,p)).
% output 'df/dp' is a vector(or matrix) of partials va... |
img1 = imread('up.jpg');img2 = imread( 'right.jpg' );img3 = imread( 'down.jpg' );img4 = imread( 'left.jpg' );
% make gray scale images
gimg1 = mean( img1, 3 ); mean1 = mean(gimg1(:));
gimg2 = mean( img2, 3 ); mean2 = mean(gimg2(:));
gimg3 = mean( img3, 3 ); mean3 = mean(gimg3(:));
gimg4 = mean( img4, 3 ); mean4 ... |
%% Light-induced Pupil Constriction Model
clc
close all
clear all
%% Solve transient equation by Method of Lines (discretizing time)
% Physical Parameters:
params.L = 1;
params.R = 1;
params.D = 1;
params.vp = 1;
params.Eu = 3;
params.lambda = 3 * pi;
params.Re = 1;
params.Pe = 2;
params.Sh = 0.4;
params.lb = 1;
param... |
function dx = odefun2(t,x)
dx = fq2(x,[1;10]);
end
|
classdef lineScan < handle
properties
name = [];
location = [];
time = [];
red = [];
green = [];
numTrials = [];
greenRed = [];
peaks = [];
stimTimes = [];
end
properties (SetAccess = private, Hidden = true)
redRaw... |
clear all;
close all;
N = 128; % lenght of the PRBS sequence
M = 8; % number of samples per bit
if M<1
fprintf('\t\t ERROR\t\t\n');
fprintf('Number of samples per bit is less than 1\n');
return;
end
for k=1:N
if (uk(k) == -1)
for i=1:M
waveformTemp(k,i) = [-1];
... |
% Take the number 192 and multiply it by each of 1, 2, and 3:
%
% 192 × 1 = 192 192 × 2 = 384 192 × 3 = 576
%
% By concatenating each product we get the 1 to 9 pandigital, 192384576. We
% will call 192384576 the concatenated product of 192 and (1,2,3)
%
% The same can be achieved by starting with 9 and multiplyi... |
function [ cost, grad ] = stackedAECost(theta, inputSize, hiddenSize, ...
numClasses, netconfig, ...
lambda, data, labels)
% stackedAECost: Takes a trained softmaxTheta and a trainin... |
max = 10;
n = 30;
x = linspace(0,max,n);
y = sin(x);
N = 2;
X = linspace(0,max,N*n);
Y = interp1(x,y,X,'spline');
t = linspace(0,max,max*1000);
f = sin(t);
plot(x,y,'bx'); hold on;
plot(X,Y,'ro');
plot(t,f,'g'); |
function epsilon = Lorentz(ep_0, ep_inf, w_t, g_0,w)
% Returns the Lorentz model based effective permittivity
% Input parameters
% ep_0 dc limit of the permittivity
% ep_inf high-frequency limit of permittivity
% w_t Phonon frequency/ Plasma Frequency
% g_0 Relaxation rate
% w angular frequency
epsilon = ep_inf + (ep_0... |
classdef gmmModel
properties(GetAccess='public', SetAccess='public')
% initialize parameters
mu = [];
sigma = [];
lambda = [];
lambdai = [];
k;
bound;
end
methods(Static = true)
% building a gmm model
function obj = build(x,k)
obj ... |
function Mesh = BuildRegularSquare(nptsx, nptsy)
tic;
[ele, node] = regular_triangular_mesh(nptsx,nptsy);
NNODE = size(node,1);
NELE = size(ele,1);
nlab = zeros(NNODE,1);
nlab(node(:,1) == 0 | node(:,1) == 1 | node(:,2) == 0 | node(:,2) == 1) = 1;
elab = ones(NELE,1);
tspig = [];
slab = [];
for ie=1:NELE
e... |
function robot = gen_fixed_leg_reflected()
%% Init
addpath(genpath(pwd))
clear;clc;
robot.name = '2 DOF 2-Link Planar Monoped';
robot.base = 'fixed';
robot.dimensions = 'planar';
robot.flagFloat = false;
robot.transmission = 'ser';
robot.parent = [0 1 0 1 ];
robot.nBase = 0;
robot.nLimbs = 2;
robot.nTransmission =... |
function [x, resnorm, residual] = levmarq(func, x0)
%Parameters
TOL = 1e-3; %tolerence
u = 100; %the damping parameter mu
maxIter = 1000; %max nbr of iterations
x = x0; %initial guess vector
if(size(x, 2) > size(x, 1))
x = x; %must be given as column vector
end
N = length(x);
I = eye(N, N);
%counters
iter = 0;
k... |
% Limpar
clear all
close all
clc
%Inicio
mdl_planar2 %Load do modelo planar 2
% Cordenadas da base (Espaço cartesiano)
p2.base=transl(0,-1.5,0);
po = 20; % numero de passo para desenhar cada traço
% Cordenadas para desenhar a Letra B
% Ponto 1 a 2
pp1 = transl(0,-0.5,0); % posição 1
pp2 = transl(0,0,0); %... |
clear
close all
%%%%%%%%%%% Most Recent Upload to SHARCNET: APRIL 5th,2017 %%%%%%%%%%%%%%%%
savepath = '/work/a2grace';
%Read in parameters from spins.conf
%This requires a buch of David's functions
%It's just easiest to import the SPINSmatlab folder from Boogaloo
%All the functions are there
... |
function [theta, phi, bias] = lldm(phiPriorMean, thetaPriorMean, biasPriorMean, phiInit, thetaInit, biasInit, phiPrec, thetaPrec, biasPrec, options, data, maxiter, dataNumber, impFeat)
savefile = strcat('modelsResult', num2str(dataNumber), '.mat');
dataN = sum(data,2);
numDocs = size(data, 1);
numWords = size(d... |
function [ count1 count2 cooccur ] = compareLabels( label1, label2 )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
count1 = length(unique(label1));
count2 = length(unique(label2));
cooccur = zeros(count1, count2, 'int32');
x = reshape(label1, size(label1, 1)... |
function [ResCont] = ResampleContour(cont,NumofPoints)
% Perform resampling using splines.
cont = ResampleSequence( cont, NumofPoints*3 );
FirstCont = cont;
[l,c] = size(FirstCont);
step = l/NumofPoints;
ResCont = zeros(NumofPoints,c);
for i=1:NumofPoints
nextP = max(floor(i*step),1);
ResCont(i,:)... |
% Rechnerunterstuetzte Mechanik I
% Wintersemester 2018/19
%
% Uebung 4:
% Differentialoperatoren
%
clc; % Konsole löschen
close all; % Alle Figures löschen & schließen
clear; % Speicher leeren
disp('4. Uebung im Fach Rechnerunterstuetzte Mechanik I (WS 2018/19)');
%%%%%%%%%%%%%%%%%
%%% AUFGABE 1 %%%
%%%%%... |
function [w,b] = train( fileName)
%UNTITLED8 Summary of this function goes here
% Detailed explanation goes here
load(fileName);
c=1e-2;
w=zeros(10,496);
bias=zeros(10,1);
for i=1:10
x=Model.TrainFeatures;
t=zeros(size(Model.TrainLabel));
t(Model.TrainLabel==(i-1))=1;
... |
function c = fn_ismemberstr(a,b)
% function c = fn_ismemberstr(a,b)
%---
% same as ismember(a,b), but much faster!!, for cell arrays of strings
% Thomas Deneux
% Copyright 2007-2012
if ~iscell(a)
a = {a};
if ~iscell(b)
error('one of the two argument must be a cell array of strings, use ismember inste... |
%Metodo de Broyden para ecua no lineales
%x^(k)=x^(k-1)-(J(x^(k-1))^(-1)*F(x^(k-1))
clear all
clc
fprintf('SOLUCION NUMERICA DE SISTEMAS NO LINEALES METODO DE BROYDEN\n');
opc=input('Ingrese el número de ecuaciones dadas: ');
switch opc
case 2
fprintf('DOS ECUACIONES\n');
syms x1 x2
A=0; F=0... |
function PHI=phase(G)
%PHASE Computes the phase of a complex vector
%
% PHI=phase(G)
%
% G is a complex-valued row vector and PHI is returned as its
% phase (in radians), with an effort made to keep it continuous
% over the pi-borders.
% L. Ljung 10-2-86
% Copyright (c) 1986-98 by The MathWorks,... |
%for notch dynamic range
%t for
str=zeros(1,1000);
for n =0:0.001:0.4
a=Notch();
for i =1:100
a.iteration(1,n);
hold on
end
plot(10*n,a.GFP,'.','Color',[0.5-n 0.5+n 0.5+n])
end
hold off
xlabel('#neighbor');
ylabel('RFU'); |
% echo_delete.m
% 例17,回声消除系统
% 北京邮电大学,尹霄丽
% 2018年12月
% 首先调入一个声音信号
close all
load splat;
sound(y,Fs);
t=(0:length(y)-1)/Fs;
plot(t,y);
xlabel('time (s)');
ylabel('y(t)');
h=[1 zeros(1,Fs) 0.3]';
zeros_padding=zeros(1,length(h)-1);
yy=filter(h,1,[y' zeros_padding]');
sound(yy,Fs);
figure;
tt=(0:length(yy)-1)/Fs;
plot(tt... |
function [ X,L,K ] = polysparse( Z,deg,w1,w2,k )
%polysparse Optimal sparse piecewise polynomial approximation
% Union of Subspaces projection
% polysparse(Z,deg,w1,w2,k) returns the sparse piecewise
% polynomial signal X which is closest to Z, with parameters (w1,w2,k).
% (more details below)
%
% Input :
% - Z... |
function [optimized_training_set, optimized_labels] = remove_outliers(full_training_set, full_training_labels)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
optimized_training_set = full_training_set;
optimized_labels = full_training_labels;
feature_var = var(full_training... |
classdef CLASS2_LOADVI_INTERFACE_LoadVideo < handle
% Set the address for different kinds of files
methods (Abstract)
LoadVideo(obj)
GetFrame(obj)
Reset(obj)
end
end |
function YorN=TestGaussianBasis()
load TestData;
[D,V] = GaussianBasis_Coef(S,u,b);
mask=ones(1,8);
YorN=1;
%% Test RTOP
RTOP_true=[2792 3268 3919 9473 5924 5288 2632 3159];
RTOP=ComputeRTOP(D,V,mask);
if(sum(round(RTOP/1e2)~=RTOP_true))
YorN=0;
sprintf('RTOP... |
%setInfo_abl
if get(H.abl_buildOnly,'value') | exist1('H.composite_fig')
XStimParams.buildOnly = 1;
else
XStimParams.buildOnly = 0;
end
set(H.abl_buildOnly,'value',XStimParams.buildOnly);
% increment test number
if(exist1('H.ablfig') & get(H.inc_testnum,'Value'))
XStimParams.testnum = XStimPara... |
function delay_calc_summary(strFile,dIn,dOut,rdat,ddat,zdiff,sliceToShow,strFileOut)
% $Id: delay_calc_summary.m 1437 2014-06-23 13:47:19Z klitinas $
% $HeadURL: svn+ssh://klitinas@anger.engin.umich.edu/svn/matlab/img/trunk/delay_calc_summary.m $
hFig = figure;
set(hFig,'color',[1 1 1]);
%set(hFig,'PaperPosition',[0.... |
close all; clear all; clc;
B=[0,1,0,0,0;1,0,1,0,0;0,1,0,1,0;0,0,1,0,1;0,0,0,1,0];
%B=[2,-1,0,0;-1,2,-1,0;0,-1,2,-1;0,0,-1,2];
I = eye(size(B));
[q,p]= hyman(B-I,0);
Lam=eig(B); |
x=5:0.001:15;
% Retângulo [(5,A1*5+B3), (9,A2*9+B2), (10,3), (15,7)]
hold on
A1=((7-3)/(15-10));
A2=-A1;
B1=3-A1*10; % reta 1
YR1=A1*x+B1;
B2=7-A2*15; % reta 2
YR2=A2*x+B2;
y=A2*9+B2;
B3=y-A1*9; % reta 3
YR3=A1*x+B3;
y=A1*5+B3;
B4=3-A2*10; %reta 4
YR4=A2*x+B4;
y=A2*5+B4;
intersecte=(B4-B3)/(A1-A2);
XXR=[x];
YYR=[YR4... |
%1.1.1
clc;
close all;
clear;
data = importdata('datasets/linearregression_homework.mat');
x_test = data.x_test;
x_train = data.x_train;
y_target = data.y_target;
y_test = data.y_test;
y_train = data.y_train;
l_max = 18;
fig1=figure();
y_our_train = zeros(length(x_train), l_max);
for l = 0:l_max
disp(['l=... |
% Sample 12
Domain.InputVertex = [ 0 0
1 0
1 1
0 1];
Domain.Boundary.Values = [1 2 3 4] ;
Domain.Holes.Hole = [];
Domain.Segments.Segment = [];
BC.Boundary.Values = [1 2 4 3];
BC.InputVertexValues = [5 7 0 1];
BC.Values = [0.0 20.0 0.12 0.0 0.654 -1 0.33]
BC.Holes.Hole = [];
BC.Segments.S... |
function ccStruct = parameters(~)
%PARAMETERS Returns a parameter structure with default values for correlation analysis.
% This function exists only to return a default parameter structure that governs the entire correlation analysis. The
% fields and substructures within the output constitute all possible user in... |
function [ f_vec ] = mah_fuhrer( vec, smooth_window )
f_vec = abs(real(fft(vec)));
% gaussFilter = gausswin(smooth_window);
% gaussFilter = gaussFilter / sum(gaussFilter); % Normalize.
% % Do the blur.
% f_vec = conv(f_vec, gaussFilter);
end
|
function D = malign(A,B,C,Tolerance)
D = cell(size(C));
ai = [];
bi = [];
for i=1:size(A,1)
[v,j] = min(abs(A(i,1)-B(:,1)));
if v < Tolerance
ai = [ai,i];
bi = [bi,j];
end
end
for i=1:length(C)
D{i} = nan(size(A,1),size(C{i},2));
D{i}(ai,:) = C{i}(bi,:)... |
function M = UpdateMatrices(R0,R1,v_cnt)
%--------------------------------------------
width = 200;
%--------------------------------------------
M = zeros(1,width*5);
%--------------------------------------------
for h_cnt = 0: width-1
R0_data_1 = R0(1,h_cnt*5+1);
R0_data_2 = R0(1,h_cnt*5+2);
R0_data_3 = R0(1,h_c... |
% Date : 2018-07-22
% Author : Niko Jozic
% Course : DSP2
close all; clear all; format compact;
clc; set(gcf,'color','w');
Fs = 360; % Hz sampling frequency
% % Notch filter
f0 = 50; %hz for the notch filter
Q = 20;
w0 =2*pi*f0/Fs;
dw =w0/Q;
r = 1-dw/2;
b = [1 -2*cos(w0) 1];
a = [1 -2*r*cos(w0) r^2]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.