text stringlengths 8 6.12M |
|---|
function [ H, data ] = meanCurv( mesh, vertices, mode )
%MEANCURV estimate mean curvature at vertices
% [Ryan Schmidt rms@dgp.toronto.edu 09/2008]
% - if vertices is undefined/empty, compute for entire mesh
% - returned data is mode specific
% - valid modes are:
% 'normal' - Schneider & Kobbelt 01 v... |
clear; close all; clc;
% Parameters for this code
CompareFmincgWithManualIterations = 0;
ComputeNormalEquation = 0;
BinaryClassificationManual = 0;
MultiClassClassification = 1;
% Use a test vector X
X = [0.01 : 0.01 : 8]; %1xm
X = X'; %Make it mx1
% y = X^2 + 3
%y = (X .* X) + 3;
y = sin(X);
%y = (X + 3) - X;
... |
% ==========================================================================
% Patick Chabelski - 998242012
% AER510 Project 1 - Bypass Engine Optimization
% ENGINE: 2-spool turbofan engine, high-pressure turbine operating the core
% compressor, low-pressure turbine operating the fan.
% GOAL: Minimize Cost Function vi... |
classdef gameConstant < Game
%GAMECONSTANT This is a concrete class defining a game where rewards a
% are fixed.
% Nothing needs to be filled up here - this is a complete example
% Only the constructor is defined here
methods
function self = gameConstant()
% The construc... |
function BoxResiduals
% BoxResiduals usage:
%
% BoxResiduals
%
% Compares results from multiple runs of FABBER by making box-and-whisker
% plots of the residuals.
%
%
% Copyright (C) University of Oxford, 2017
%
%
% Created by MT Cherukara, 24 October 2017
%
% CHANGELOG:
% while loop to keep adding datas... |
function Y = OFDMmodulator(data)
%input data in cell array
%number of data subcarriers
numOfSubCar = 53;
numOfChannelSymbols = ceil(length(data)/numOfSubCar);
H = comm.OFDMModulator;
Y = {};
for iChannSymb = 1 : numOfChannelSymbols
dataInd = (iChannSymb-1)*numOfSubCar + 1 : min((iChannSymb-1)*numOfSubCar + 53,... |
function [xs,ys,info] = sedumi2sdpam(As,bs,cs,K,opts)
% function [x,y,info] = sedumi2sdpam(A,b,c,K,opts);
%
% DESCRIPTION
% This function solves a cone optimization specified in Sedumi format
% using the SDPAM solver. The function converts the inputs from
% Sedumi format to SDPAM format, solves the problem with ... |
% defining relevant parameters
t= -10:0.001:10;
y=zeros(0,length(t));
N=1;
% define relevant expressions
syms t;
T= 2*pi;
a=-pi;
b=pi;
xt = cos(t);
% function call to fourierCoeff which returns array of fourier coefficients
F = fourierCoeff(N,T,t,xt,a,b);
% plotting
FS_idx = -N:N;
figure; stem(FS_idx,F); grid on... |
function [P,F,df1,df2] = angequalmeans(ang1,ang2,method)
% ANGEQUALMEANS - Test for equal means in two groups of angles
%
% [P,F,df1,df2] = angequalmeans(ang1,ang2,method)
%
% Test for equal means in the two groups ang1 and ang2 using one of
% the following methods:
% 'watson-williams','ww','parametric': Parametr... |
%used to regenerate technical, trajectory or metadata files:
%comment out what you don't need to produce...
clear all
global THE_ARGO_FLOAT_DB
global ARGO_SYS_PARAM
if isempty(ARGO_SYS_PARAM)
set_argo_sys_params;
end
getdbase(0);
count = 0; %using this to just do 5 floats.
%% Iridium
for ii = 1:length(THE_ARGO_FL... |
function isgn = r8vec_compare ( n, a1, a2 )
%*****************************************************************************80
%
%% R8VEC_COMPARE compares two R8VEC's.
%
% Discussion:
%
% The lexicographic ordering is used.
%
% Example:
%
% Input:
%
% A1 = ( 2.0, 6.0, 2.0 )
% A2 = ( 2.0, 8.0, 12.0 )
%
... |
% A set of test commands deisgned to check how splitting data into a
% positive and negative branch affects the outcome.
[m,n] = size(XDat);
W_split = [w_pos,w_pos];
X_split = zeros(2*m,n);
X_pos = zeros(m,n);
X_neg = zeros(m,n);
for i = 1:n
for j = 1:m
if XDat(j,i) >=0
X_split(j,i) = XDat(j,i)... |
function StatisticsandVisualisation(hStorage,runTime,timeSteps,FEvals,tInterval,z,espis,type,choice)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This function takes in the output from the model and performs either
% visualisations or statistics on the output depending on the user inupt... |
%Testing Fourier Transform
function c = FourierTransform(Lam,MM4,width);
w = width/2;
for x = 1:length(Lam)
if (x > w) && (x < (length(Lam)-w))
LamNew = Lam(x-w:x+w);
Fs = (LamNew(length(LamNew))-LamNew(1))/length(LamNew);
t = (0:length(LamNew)-1)/Fs;
Y = fft(MM4((x-w):(x+w)));
... |
function [ss, iter] = inprod_Dbasis_Data2LD(fdobj1, fdobj2, ...
coefStr1, coefStr2, ...
Lfdobj1, Lfdobj2, ...
EPS, JMAX, JMIN)
% INPROD_DBASIS Computes the three-way tensor... |
function MatingPool = MatingSelection(PopObj,Rank)
% The mating selection of one-by-one EA
%--------------------------------------------------------------------------
% The copyright of the PlatEMO belongs to the BIMK Group. You are free to
% use the PlatEMO for research purposes. All publications which use this
% pla... |
clear all
%% Phantom Parameters
x_size = 10; %x size of phantom
y_size = 10; %y size of phantom
z_size = 30; %z size of phantom
%% Read Parameters from .mat file for each peak
SI = zeros(x_size,y_size,z_size); %create array of zeros to save the intensity of phantom
Positions = load('PhantomTrial1');
parm = Positions... |
###############################################################################
# Return the probability of false positives
###############################################################################
# Authors:
# --> Catarina Silva
#
###############################################################################
#
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 本函数用于计算修正夏普比
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function modifiedSharpeR = modifiedSharpe( R,Rf,VaR)
loc = isnan(R) | isnan(Rf);
R (loc) = [];
Rf(loc) = [];
udAlpha = VaR;
z = udAlpha;
S = skewness(R);... |
table_data = readtable('../model/test.csv');
|
% This function takes 3-D points and their reprojection 2-D points in
% setero camera, then do the bundle adjustment.
% Inputs:
% P - Nx3 matrix of 3D coordinates
% p1 - Nx2 set of points in left camera
% p2 - Nx2 set of points in right camera
% K1 - 3x3 camera calibration matrix 1 of left camera
% K2 - 3x3 ... |
function binary_serial_video_encoded = huff (frame_size, numfiles)
load('video_ypbpr.mat', 'video_Y_serial', 'video_Pb_serial', 'video_Pr_serial');
load('serial_class.mat', 'class_Y_DC', 'class_Y_AC', 'class_PbPr_DC', 'class_PbPr_AC');
load('huffman_dict.mat', 'dict_Y_DC', 'dict_Y_AC', 'dict_PbPr_DC', 'dict_PbPr_AC');... |
function normX = Norm( X, type )
% Norm Matrix or vector norm.
% norm(X,2) returns the 2-norm of X.
%
% norm(X) is the same as norm(X,2).
%
% norm(X,1) returns the 1-norm of X.
%
% norm(X,Inf) returns the infinity norm of X.
%
% norm(X,'fro') returns the Frobenius norm of X.
%
% In addition, for ... |
function bc = util_get_betweenness( network_connection_matrix, varargin )
%UTIL_GET_BETWEENNESS Calculate the betweenness centrality from network
%connection matrix.
% Input:
% network_connection_matrix: The network connection matrix. (CCPeak)
% thresholding: Used to threshold the netw... |
clear all;
close all;
syms t 'positive'
syms w 'real'
syms y(t)
syms tau
G = fourier(1/y(t))
|
clear all
close all
clc
%%
% Insert the name of the file e.g. smallnetwork_adj
%filename = input('Insert the name of the file without the file type (e.g. example) : ','s'); % Insert the txt file's name
uiwait(msgbox('Browse to your file'));
[FileName,PathName] = uigetfile('*.txt','Select the input fi... |
function [ds, bs, trees] = imgdetect(im, model, thresh, ds_prev)
% Wrapper around gdetect.m that computes detections in an image.
% [ds, bs, trees] = imgdetect(im, model, thresh)
%
% Return values (see gdetect.m)
%
% Arguments
% im Input image
% model Model to use for detection
% thresh Detection ... |
function out = camel(str)
%CAMEL Converts a string to camelCase using regular expressions.
%
%INPUTS:
% str - String or cell array of strings.
%
%OUTPUTS:
% out - CamelCased version of input.
%
%SYNTAX:
% out = camel(str)
% Copyright 2013, The MITRE Corporation. All rights reserved.
%==============================... |
function ds = modelTestSets(exp_id, fun, dim, inst, varargin)
% ds = modelTestSets(exp_id, fun, dim, inst, opts) creates/loads dataset
% from experiment 'exp_id'.
%
% Input:
% exp_id - experiment id where the CMA-ES logs are saved
% fun - BBOB function numbers to load
% dim - dimensions to load (2, 3, 5, 10... |
function pcaTrajectoriesCalcDistance(outputPath, generalProperty, imagingData, BehaveData)
% the output path contain the path of the file to be saved and the
% animalname and the date split by char ','
% it can be like this - 'C:\\,output.xlxs,M31,21/1/18'
splitRes = strsplit(outputPath,',');
% analysis
[labels, exami... |
clc
clear
close all
%% 1. for original image
org_img = imread('original.jpg');
if size(org_img,3)>1
org_img = rgb2gray(org_img);
end
[org_M, org_N] = size(org_img);
org_hist = imhist(org_img);
org_cdf = cumsum(org_hist) / (org_M*org_N);
%% 2. for reference image
ref_img = imread('reference.jpg');
i... |
function [solution,mu_vec,cpt_qp,mem] = mpc_qp_solve_dense(H,g,C,lu,uu,lc,uc,sizes,mem)
nu=sizes.nu;
N=sizes.N;
options = qpOASES_options('MPC');
if mem.qpoases.warm_start==0
[QP,solution,fval,exitflag,iterations,multiplier,auxOutput] = qpOASES_sequence('i',H,g,C,lu,uu,lc,uc, options);
... |
function [string,startRT,endRT] = GetEchoStringFreeResponse(window,msg,x,y,cueColor,bgColor,respColor,margin)
%
% [string,startRT,endRT] = GetEchoStringFreeResponse(window,msg,x,y,cueColor,bgColor,respColor,margin)
%
% Gets a subject's response to question MSG and displays it as they're typing.
%
% This version w... |
%log(range)
function feature_v = featureLogRange(enf)
max_enf = max(enf,[],2);
min_enf = min(enf,[],2);
range_enf = log(max_enf - min_enf);
feature_v = range_enf;
end |
function [Ptx,Pty,Pn,dtxdux,dtxduy,dtxdun,dtydux,dtyduy,dtydun,dtndun] ...
= BOUCWEN_U_P(uxyn,pn0,pars,uxyntxynp)
%BOUCWEN_U_P 3D Planar uncoupled Bouc-Wen model Pressure and Jacobians
% USAGE:
% [Ptx,Pty,Pn,Jttx,Jtnx,Jtty,Jtny,Jnn] = BOUCWEN_U_P(uxyn,pn0,pars,uxyntxynp);
% INPUTS:
% uxyn : (Npx3) 2 tangenti... |
function [p,s] = CV_total_LS(x,y)
%
%CV_total_LS - total least squares method to fit best line to points
% (Forsyth and Ponce page 335
%On input:
% x (nx1 vector): x coordinates of points
% y (nx1 vector): y coordinates of points
%On output:
% p (1x3 vector): coefficients of best fit l... |
% ex06 : gstat example ex06.cmd
cmd_file='ex06';
[pred,pred_var,pred_covar,mask,G]=gstat(sprintf('%s.cmd',cmd_file));
figure(6),clf;
imagesc(mask.x,mask.y,pred(:,:,1));
cb=colorbar;
axis image
title('Unconditional Gaussian simulation')
watermark(sprintf('GSTAT %s.cmd - %s',cmd_file,G.mgstat.comment{2}));
pri... |
function [y,elev,wse] = ExtractMCS
%%
%Loads and plots the mean cross section bathymetry for a series of files
%from .mat files output from VMT. Flips XS if looking upstream so all XS
%should be oriented looking DS.
%P.R. Jackson, USGS, 7/16/09
%% Load the files
% Prompt user for directory containing f... |
for i=1:11*11
sxx=sxx2(i);sxy=sxy2(i);sxz=sxz2(i);
syx=sxy2(i);syy=syy2(i);syz=syz2(i);
szx=sxz2(i);szy=syz2(i);szz=szz2(i);
s=[sxx sxy sxz;syx syy syz;szx szy szz];
[v,d]=eig(s);
dd=eig(s);
Ta(i)=max(dd);
Pa(i)=min(dd);
for j=1:3
[thet(j),phi(j),r(j)]=cart2sph(v(1,j),v(2,j),... |
function [theta] = main()
[X_train,Y_train,X_test,Y_test] = load_planets_data('../data/habitable_planets_detailed_list.csv','../data/non_habitable_planets_confirmed_detailed_list.csv','../data/feature_index.csv');
[theta] = logistic_regression(X_train,Y_train);
fprintf('%f \n', theta);
fflush(stdout);
[er... |
function [ P_bd ,Detector_Mask,R] = myP_bd_Tube_Calculator( Resolution,N )
Grid_x_start=-Resolution;Grid_x_end=-Grid_x_start;Grid_y_start=Grid_x_start;Grid_y_end=Grid_x_end;
[X,Y] = meshgrid(Grid_x_start:Grid_x_end,Grid_y_start:Grid_y_end);
R=sqrt(Grid_y_end.^2+Grid_x_end.^2)/sqrt(2);% Radius of CT Scanner
Theta_S=... |
function Lfdobj = Lfd(m, wfdcell, afdcell, ufdcell)
% LFD creates a linear differential operator object of the form
%
% Lx(t) = w_0(t) x(t) + w_1(t) Dx(t) + ...
% w_{m-1}(t) D^{m-1}x(t) + D^m x(t) + ...
% a_1(t) u_1(t) + ... + a_k(t) u_k(t).
%
% Function x(t) is operated on by this operator L, ... |
function outlist = permutations(repeats,amount)
numbers = 1:4;
total_permutations = perms(numbers);
list = zeros(1,8);
for i = numbers
end_in_i = total_permutations(total_permutations(:,end) == i,:);
remaining = numbers(numbers~=i);
for j = remaining
for k = 1:length(end_in_i(:,1))
start... |
function [fileseries, filenames] = retrieve_files(session, run,type,subjects)
% Goes into the timeseries file and retrievesthe timeseries txt files into
% numeric matrices.
%INPUT:
% session: put in '1','2', or '*' (to choose sessions 1,2, or both)
% run: put in '1','2','3', some cell combo, or '*'. To pi... |
% This script aims at demonstrating the efficiency of the method
clc
clear
close all
% Parameters
path = 'Img/';
image = imread(strcat(path,'Diving.jpg'));
image = im2double(image);
figure
imshow(image)
% Running the MSRCR algorithm
sigmas = [15,80,250];
s1 = 2;
s2 = 2;
resulting_image = MSRCR(image,sigmas,s1,s2);
fi... |
function [surface, surfaceCoordinates] = getSurfaceForMember(memberBoundingBox, zGrid, splintLineX, splintLineY)
memberXMin = memberBoundingBox(1);
memberXMax = memberBoundingBox(2);
memberYMin = memberBoundingBox(3);
memberYMax = memberBoundingBox(4);
coverCells = cell(size(zGrid, 1), size(zGrid, 2... |
%% Stelling 9
%
% De diff() functie differientieert de aangeboden vector.
%
Antwoord = 0;
|
function g = gpdmdyngradientTheta(params, X, seg, priorModel, Xin, Xout)
ndp = 0;
if (priorModel(3) == 0)
ndp = 4;
elseif (priorModel(3) == 1)
ndp = 3;
elseif (priorModel(3) == 2)
ndp = 2;
elseif (priorModel(3) == 3)
ndp = 6;
elseif (priorModel(3) == 4)
ndp = 3;
elseif (priorModel(3) == 5)
ndp = 4;
end
... |
function clearRecord()
global recX recY recZ recRoll recPitch recYaw recF;
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
recX=[];
recY=[];
recZ=[];
recRoll=[];
recPitch=[];
recYaw=[];
recF=[];
recExist=[];
end
|
function sel = selectgroups(varargin)
% function sel = selectgroups(gp1,gp2,gp3...)
% or selectgroups(groups)
%
% Selects unique combinations of different groups using a GUI. gp1 etc are
% variables that have the same size. selectgroups attempts to extract the
% name of the group from the variable name, b... |
function ansfi=fi(T,P,comp,K,y,z,n)
R=8.314;
b=.07779*R*comp.Tc./comp.Pc;
bm=sum(b.*y);
a=.45724.*(1+(.37464+1.54226*comp.w-.26992*comp.w.^2).*(1-(T./comp.Tc).^.5)).^2.*R^2.*comp.Tc.^2./comp.Pc;
am=0;
for i=1:size(y,2)
for j=1:size(y,2)
am=am+(a(j)*a(i))^.5*y(j)*y(i)*(1-K(i,j));
end
end
B=bm*P/R/T;
q=am... |
function movie_population_ana
% SOM later population
animalids = {'150401','150527','150529','150602','150603','150623','150625','150825','150831','150902','150909', '150915', '150916', '150916', '151022', '151023', '151109', '151110', '151209', '151221','160718','160721','160725','160726','160726','160728','160728','... |
function [] = writeprmold(i,vsurfadd)
global caseid time_interval
% write prm file for SAM with updated caseid
A = regexp(fileread('DRY/prm'),'\n','split');
A{3}=[' caseid =''CRM_test_59h_' caseid '_' num2str(i) ''','];
switch i
case 0
A{5}=[' nrestart = 0,'];
A{8}=[' nrestart_skip = 35,'];
... |
function [BMS] = PXP_random_plot_v1( bicE, title_tag ) % minus has to be added!
[BMS.alpha( 1, :), BMS.exp_r( 1, :), BMS.xp( 1, :), BMS.pxp( 1, :), BMS.bor( 1, :)] = spm_BMS( bicE );
ex1 = BMS.pxp( 1, :);
nn = size( ex1, 2);
ex1_rev = zeros(1,nn);
for ii = 1:nn;
ex1_rev(1,ii) = ex1(1,nn+1-ii);
end
figure... |
clear
close all
clc
root_path = '/mnt/disk/yongxu_liu/datasets/WELL_Set_run/run/data/';
load([root_path, 'dataset.info.mat']); % the info data for WELL-Set
% for st-RRED_opt
addpath(genpath('matlabPyrTools'))
addpath(genpath('functions'))
% model = 'vmaf_v0.6.1.pkl';
if ~exist('tmp_path', 'dir')
mk... |
# TP NUMERO 1 -- PEAJES -- Puntos A, B y C
# PUNTO A: load data
data = load('dataset/FlujoVehicular2019.dat');
# mapeo nombres - columnas del dataset
mes = 1;
diames = 2;
hora = 3;
diasemana = 4;
estacion = 5;
sentido = 6;
tipovehiculo = 7;
formapago = 8;
cantidadpasos = 9;
# PUNTO B: Balances... |
function [ z,P ] = noise_gen_URA( r )
%UNTITLED4 此处显示有关此函数的摘要
% 此处显示详细说明
%% Initialization
fs = 16000; % Sample frequency
NFFT = 512; % Number of frequency bins (for analysis)
w = 2*pi*fs*(0:NFFT/2)/NFFT;
c = 340; % Speed of sound
L = 2^18; ... |
%% Identifying Monetary Shocks
% Xiao Xu, xx2251, Macro PS3, Prof. Mertens
clear all;
clc;
filename = 'CEE1999data.xls';
data = xlsread(filename);
dates = data(:,end,1);
T = length(dates);
y = data(:,2); % Output
p = data(:,3); % implicit price deflator
pc = data(:,4); % change in CPI
rff = data(:,5); % effective ... |
clc; clear; close all;
% INPUT
x = [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20];
f = [0 0.1 0.5 1 1.5 3 2.5 1.5 1 0.7 0.9 1.2 1.8 2 1.9 1.6 1.3 1 0.9 0.8 0.7];
n = length(x);
fp0 = 0.1;
fpn = -0.1;
% Calculate h
h = [];
for i=1:n-1
h(i) = x(i+1)-x(i);
end
% Constructs A matrix for simultaneous... |
[x y z] = size(image)
for i=1:x
if image(i+1,1,1) ~= image(i,1,1)
i
break;
end
end |
%% Problem 4
clear all
% load data
load HW84.dat
xdat = HW84(:,1);
ydat = HW84(:,2);
ft = fittype( 'a*exp(-b*x)*cos(c*x)', 'independent', 'x', 'dependent', 'y' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.Lower = [5 -Inf -Inf -Inf];
opts.StartPoint = [10 0.808157185957016 0.619... |
function q = inverse_kuka(H, myrobot)
d = myrobot.d;
a = myrobot.a;
% wrist position
end_effector_to_wrist = eye(4);
end_effector_to_wrist(1,4) = -a(6);
end_effector_to_wrist(3,4) = -d(6);
H_wrist = H*end_effector_to_wrist;
x = H_wrist(1,4);
y = H_wrist(2,4);
z ... |
function [errorCode, errorMsg,token] = Login(connection,operator,password)
import com.hundsun.esb.* com.hundsun.esb.data.*;
[errorCode, errorMsg, packet] = CallService(connection,MakeRequestPacket(operator,password));
PrintPacket(packet);
if errorCode >= 0
token = GetToken(packet);
end ... |
function GauseSeidel(A, b, n)
aug=[A, b];
h = 0.1e-5;
isConsistance = 0;
ref = zeros(1:n);
initialMatrix = zeros(1:n);
while (isConsistance == 0)
for i=1:n
solution(i) = aug(i, n+1);
for j=1:n
if(i~=j)
solution(i) = solution(i)-( aug(i,j)*initialMat... |
function [cluster_relation,cr] = data_cluster_plot(H,folder,method)
%get likehoods of cell belonging to clusters
H_new = H./sum(H,2);
cluster_relation = H_new'*H_new;
cr = cluster_relation;
%ignore small value
cr(cr==min(min(cr)))=0;
if size(H,2)>3
cr(cr==min(min(cr(cr~=0))))=0;
end
figure;
G = graph(cr,'OmitSel... |
function P = CompProbDirichlet(Htest, Htrain,prior)
% log probability using the dirichlet distribution
% It becomes the multinomial distribution when prior =0
% H has to be coloumn vectors.
index = Htrain(:) > 0 | Htest(:) > 0;
Htrain = Htrain(index);
Htest = Htest(index);
Hprior = prior*ones(size(Htrain));
Nprior... |
function [f,W] = appObjDistribution(s,d,W,Xf,dX,dXID,c,const,alg,pairs,p)
nx = size(Xf,1);
X = Xf;
f = zeros(nx,1);
if (strcmp(alg,'pref_only'))
% % appggbs for preference only
% % calculate areas
% f = appDistribution(nx,Xf,d,pairs,p);
% % calculate volume
... |
function MI = LeoMIfunc(isiv,isix,backward,forward,fps)
MI = zeros(1,backward+forward+1);
StimuSN = max([isix isiv]);
%v in future; x in past
for n =1:forward+1
isix2 = isix(n:end);
isiv2 = isiv(1:end+1-n);
isii2 = StimuSN*(isix2-1) + isiv2;
for k = unique(isix2)
for j =unique(isiv2)
... |
clc;
clear;
alpha= 0;
Kp=17000;
Kd=50;
Ki=.1;
Ke=1;
sim('DNS_Final_Project')
% Car Animation Script
% This Matlab script is used in conjunction with your Simulink model to
% produce an animation of the half-car body as it travels down the road
% profile defined in the EE324, Spring 2009 project description.
%
% The scr... |
function P_RX = signal_strength(E_tot)
%SIGNAL_STRENGTH Summary of this function goes here
% Detailed explanation goes here
global h_e Ra;
P_RX_tmp = 0;
for i=1:+1:size(E_tot,1)
P_RX_tmp = P_RX_tmp + abs(h_e*E_tot(i))^2;
end
P_RX_watt = P_RX_tmp*1/(8*Ra);
%Sort... |
clear;
p1 =[ 3966260.66380431
1046450.2725837
4869538.70235858];
p2=[3918048.64958489
1137556.84865841
4888102.71941542];
p1g=cart2geod(p1);
p2g=cart2geod(p2);
dist0=norm(p1-p2);
res=[];
for d=1:14
for h=0:23
cdate=[199... |
function [newTracklets, trackletIndices] = mergeTracklets( tracklets, assignments )
% [T,~,N] = size(tracklets);
% newAssignment = assignment;
% newTracklets = zeros(size(tracklets));
% counter = 1;
% for n=1:N
% indexOne = n;
% indexTwo = newAssignment(n);
% if (indexTwo > N)
% newTracklet... |
function [sample,samplestr]=getsample(mode)
% GETSAMPLE return sampling points for for monaural
% and interaural optimization.
% [sample,samplestr]=getsample(mode)
% mode=='m' returns samples for the
% optimization of the monaural transfer-
% function while mode==... |
% In the name of God
clear ;close all; clc
Td=.01;
t=800;% simulation time
tp=200;
%% main system diagram ----------------------------------------------------
%% DC Motor Parameter for Sliding Mode Controller
J=6.87*1e-5;
nu=1.041*1e-3;
k=.21;
lambda=-100000;
b=k/J;
Gamma=119.7*1e-3;
%% DC Motor Tr... |
function varargout = utstats(option,fig,varargin)
%UTSTATS Utilities for statistics tools.
% VARARGOUT = UTSTATS(OPTION,FIG,VARARGIN)
% M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 04-May-98.
% Last Revision 08-May-2012.
% Copyright 1995-2012 The MathWorks, Inc.
% $Revision: 1.4.4.7 $ $Date: 2012/06/03 06... |
function SVR_Permutation(Data_Path, Score, Real_Prediction_Path, Perm_times_Range, ResultantFolder)
for i = Perm_times_Range
i
Rand_Index = randperm(length(Score));
Rand_Score = Score(Rand_Index);
ResultantFolder_Sub{i} = [ResultantFolder filesep 'time_' num2str(i)];
mkdir(ResultantFolder_Sub{i});... |
function qOUTn = aggradeChannel(obj)
%aggradeChannel runs the numerical scheme for the one-dimensional diffusion
%equation
% Also add floodplain sedimentation in a different function or
% change the function name to domainSedimentation?
% obj: an AvulsionModel object
%
% qOUTn: a value representing the sediment ... |
% FactorGraphChild is the base class for Dimple model elements that are
% children of a FactorGraph but aren't necessarily nodes.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2015 Analog Devices, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License")... |
%%
% Ex 2.19 Problem statement
% Plot the variations of the natural frequency and the time period with
% static deflection of an undamped system using MATLAB.
% Code modified from Mechanical Vibrations - S.S. Rao
clc
close all
clear
g = 9.81; %m/s^2
for i = 1: 101 ... |
%% Bayes Factor
% This is a Matlab class to run Bayes Factor analysis.
% The code was written by Bart Krekelberg (bart@vision.rutgers.edu) with some code
% taken from Sam Schwarzkopf's code and with inspiration from the R package
% by Richard Morey.
%
% Currently the following statistical tests have been implemented
... |
function[infect,deaths,days] = Parse_Data(num,txt)
dates = txt(:,1);
dates(1) = [];
%initial conditions
CCC = 2; %cummulative confirmed cases column number
CCD = 3; %CCD = cummulative confirmed deaths column number
[rows,columns] = size(num);
SIR = zeros(rows,3);
j = 1;
offset = 0;
for i = rows:-1:1
... |
%设置取样点lambda(i)。并将lambda和频率扩展为二维矩阵,
%使不同行频率不同,同一行频率相同;不同列lambda不同,同一列lambda相同。
% lambda: 行向量;
% freq:行向量;
function [lmd_array,fre_array] = Array_trans(lambda, freq)
if (size(lambda,1)>1) &&(size(lambda,2)>1)
error('input lambda is not a vector'); % 输入非向量则报错
else
if (size(lambda,2)==1) %% 如果输入为列向量,转化为行向... |
%% --------------------------- Missile Parameters ------------------------- %
clc; clear all; close all; set(0,'defaultfigurecolor',[1 1 1]);
global rho_v rho_v_max tF M_d T_m rho_w Vc tau N K K_dth dt tout resolution
%% ---------------------- Initialize Simulation --------------------- %
MP = 1; NMP = -1; Dyn_sg... |
function Anew = diagonalize( Aold)
%DIAGONALIZE Summary of this function goes here
% Detailed explanation goes here
sz = size(Aold) ;
Anew = zeros(sz(1),sz(2)) ;
ndim = sz(2) ;
for k = 1:ndim
Anew(k,k) = Aold(k,k) ;
end
end
|
%Implemenation of the Continuous-discrete Poisson multi-Bernoulli mixture
%(CD-PMBM) filter described in
%A. F. García-Fernández, S. Maskell, "Continuous-discrete multiple target filtering: PMBM, PHD and CPHD ?lter implementations," IEEE Transactions on Signal Processing, vol. 68, pp. 1300-1314, 2020.
% Open access ve... |
% Examplescript for usage of omcompile, omrun, omparameter, omimport
% and omcleanup
% For more help, look into the help of the functions and the functions
% themselves. E.g. it's important to adapt the path to omc.exe in
% omcompile.m. You could maybe improve performance by changing some value in omimport.m
%
% ... |
function scores = leverage_score(W, k)
% compute the leverage scores of a matrix relative to the best
% rank-k approximation of A. It is equal to its squared Euclidean
% norms of the rows of the k-svd of A
% A needs to symmetric positive semi definite (?)
% Revisiting the Nystr¨om Method for Improved Large-scale Mach... |
clear all, clc, close all
% Improvements to consider:
% noise to training data
% reduce eta on iterations
trainingSet = 'data_batch_1.mat';
validationSet = 'data_batch_2.mat';
testSet = 'test_batch.mat';
[Xtrain, Ytrain, ytrain] = LoadBatch(trainingSet);
[Xval, Yval, yval] = LoadBatch(validationSet);
[Xtest, Ytest, y... |
function b = t2b(t,rank)
n = size(t,1);
if nargin < 2
W = WDF2(t);
else
W = WDF2_rank(t,rank);
end
temp = reshape(W,n^2,n^2);
temp = sum(temp,1);
temp = temp';
b = reshape(temp,n,n);
|
function updatepath(ADVISORRootDir,SupportDir)
% this function can be used to automate the process of updating the
% Matlab path to work with ADVISOR. ADVISORRootDir is the path location of
% ADVISOR relative to the current working directory and SupportDir is the
% path location of a supporting directory relative to... |
imOrig = imread('canoe.jpg');
imshow (imOrig, []);
[x1,y1] = ginput(1);
[x2,y2] = ginput(1);
window1 = imOrig(y1-3:y1+3, x1-3:x1+3,:);
window2 = imOrig(y2-3:y2+3, x2-3:x2+3,:);
X1 = double(reshape(window1, 49, 3))';
X2 = double(reshape(window2, 49, 3))';
%task3
C1=cov(X1');
C2=cov(X2');
u1=mean(X1,2);
u2=mean(X2,2);
... |
function y_out = cirmodel(x,T1,T2,Lmarket,Smarket,swaptime)
%here x is vector input,
%x(1) = phi
%x(2) = k
%x(3) = sigma (volatility)
%x(4) = r0(present interest rate)
%T1 = [1 7 30 60 90 180]; %in days
%T1 = T1/360;
%Lmarket = [0.0300 0.0302 0.0307 0.0314 0.0320 0.0335];%,market libor rate
%B = (1 - exp(-x(2)* taut... |
function res = manny()
% find the velocity that _just_ gets the ball over the wall
initial_guess = 45; % m/s
velocity = fzero(@crossover_func, initial_guess);
res = velocity;
end
function res = crossover_func(velocity)
% this function crosses through zero when the height of the ball at
... |
% // TI File $Revision: /main/3 $
% // Checkin $Date: November 1, 2010 13:05:07 $
% // =====================================================================================
% // This software is licensed for use with Texas Instruments C28x
% // family DSCs. This license was provided to you prior to installing
% //... |
function behaviorData = behaviorData(varargin)
%BEHAVIORDATA UI for selecting behavior data from a block
%
% behaviorData = cpl.BEHAVIORDATA('NAME',value,...);
%
% --------
% INPUTS
% --------
% varargin : (Optional) 'NAME', value input argument pairs.
%
% --------
% OUTPUT
% --------
% behaviorData ... |
%%get an array of records out
function [myArray]=getArray(MeasuredData, groupN, numRecords,wordlength)
clear prefix; clear Array;
k=0;
myArray=zeros(wordlength, numRecords,2,'double');
prefix=2*numRecords*(groupN-1)+groupN+1;
for n=1:(numRecords*2)
if mod(n,2)==1
k=k+1;
... |
%% ======================= real pair coherence==========================
load('C:\Users\SMukherjee\Desktop\projects\dual_eeg_eng\data\dual_eng\mat\coherence\matlab.mat', 'postlisten');
load('C:\Users\SMukherjee\Desktop\projects\dual_eeg_eng\data\dual_eng\mat\coherence\surrogate_trial.mat','index_comb');
load(['C:\Users... |
function [A1] = append(E1, points, a, b)
% Append experimental flowtest data at hourly intervals
[x,y] = size(E1);
tail_data = (x + points);
A1 = zeros(tail_data,2);
% A1(:,1) = hrs after injection
% A1(:,2) = conc.
for n = 1:119790;
A1(n,1) = E1(n,3);
A1(n,2) = E1(n,2);
end
for q... |
% function vecangleD
%
% ang = vecangleD(vec1,vec2)
%
% where: ang is the angle between the two vectors vec1 and vec2
% vec1 and vec2 are vectors: [x y z]
%
% Author: Frederic Rudawski
% Date: 20.10.2020
function ang = vecangleD(v1,v2)
% nomalize vectors
v1 = v1./norm(v1);
v2 = v2./norm(v2)... |
% Description:
% This function checks the number of images in the folder, and return the
% top n images (n: number of images per stack). The returned
% images will be moved to another folder, named "finished" and thus, this
% fuction can follow a "first-in-first-out scheme" to constantly deliver
% images for blending.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.