text stringlengths 8 6.12M |
|---|
%%BPSK Narrowband Interference
%This code will generate a QPSK waveform modulated with random data
%Then compare the frequency domain spectrum with and without square root
%raised cosine pulse shaping.
clear;
M=2 % M-ary modulation - M different symbols
n=1000; % n data symbols to be trasnmitted
data=randi(M,1,n); %%g... |
function plot_part_test(points, pc)
[r c] = size(points);
min_points = 35;
if ( r >= min_points )
step_r = 30;
%step_r = 5;
else
step_r = 1;
end;
scatter3( points(1:step_r:r,1), points(1:step_r:r,2), points(1:step_r:r,3), 5, pc, 'fill... |
function [T, Y]=FOArneodo(parameters, orders, TSim, Y0)
%
% Numerical Solution of the Fractional-Order Arneodo's System
%
% D^q1 x(t) = y(t)
% D^q2 y(t) = z(t)
% D^q3 z(t) = -b1 x(t) - b2 y(t)- b3 z(t) + b4 x^3(t)
%
% function [T, Y] = FOArneodo(parameters, orders, TSim, Y0)
%
% Input: parameters - ... |
function output = minimum(input)
output = input(1);
for n=2:1:length(input)
if input(n) < output
output = input(n);
end
end
end
|
function clique_grow = aggressive_grow(pair, clique)
clique_grow = clique;
for i = 1:length(pair)
if( sum(pair(i,clique_grow)>=1) == length(clique_grow) )
clique_grow = union(clique_grow, i);
end
end
end |
function [output1,output2,output3,output4,output5] = CP5(input_pair,input1,input2,out1,out2,out3,out4,out5,handle)
% Wrapper for the low-level CoolProp function "AbstractState update and 5
% out"
% Usage example
% CP5(gas.handle,'PT_INPUTS',linspace(1e5,2e5,10)',linspace(300,400,10)','D','C','H','T','P')
% For enthal... |
close all
clear
clc
I=imread('test_image11.png');
I2=im2double(I);
%binary gradient mask
[~,threshold]=edge(I2,'sobel'); %find threshold according to the gradient of the image
factor=1;
Bw=edge(I2,'sobel',threshold*factor); %tuning threshold
%dilate image
se90=strel('line',3,90);
se0=strel('line',3,0);
bwdil=imdilat... |
classdef Food<handle
%FOOD Summary of this class goes here
% Detailed explanation goes here
properties
id
loc
pick
h
c_id
s_id
end
methods
function initFood(obj,id,food_arr,handle)
obj.loc(1) = food_arr(1);
obj.loc(2) = food_arr(2);
obj.id =id... |
% PROVIDE appropriate paths to opencv and ANN libararies before compiling
% REQUIRE opencv
mex -v -I"/usr/local/include/opencv/" -L"/usr/local/lib/" -l"opencv_core" getConstraintsMatrix.cpp mexBase.cpp
mex -v -I"/usr/local/include/opencv/" -L"/usr/local/lib/" -l"opencv_core" getFeatureConstraintMatrix.cpp mexBase.cp... |
% Create two tests to test the function dist.m
% Each test will test a different input file:
% - rocketorbittest.mat
% - moonorbittest.mat
% Test that the file produces the correct distance between the rocket and
% the body it is orbiting i.e. earth or moon
%% Test rocketorbitest.mat
load('../rocketorbittest.mat')
de... |
function f = My_entropy_fun(x,s)
% function f = entropy_fun(x,s)
% written by Chen Li
% input: x - PHC0 and PHC1
% s - NMR Spectral data
% output f - entropy value (Using the first derivative)
%
% Modifications: Mike Tyszka, Ph.D, Caltech BIC
% Derivative order for entropy calculation
dn = 2;
... |
function result = mEllipticB( X, M )
%MELLIPTICB Jacobi's form of elliptic integral B.
% MELLIPTICB(X,M) is the elliptic integral B of the elements of
% X and M (parameter). X and M must be real and of the same size or any
% of them can be real scalar.
%
% MELLIPTICB(M) is the complete elliptic integral B o... |
% x = realizeclique(P,epsilon)
%
% Computes the realization of a clique in R^{n-1} from a nxn complete EDM
function x = realizeclique(P,epsilon)
if nargin < 2
epsilon = 1e-6;
end
[n,n] = size(P);
% realize 2-cliques in constant time
x = zeros(n-1,n); % x_1 = 0
x(1,2) = P(1,2); % x_21 = P_12
if n ... |
function makeGoal
[X1 Y1 Z1] = makeCylinder(10, 1, 'x');
surf(X1,Y1,Z1);
hold on
[X2 Y2 Z2] = makeCylinder(20, 1, 'z');
Z2 = Z2 - 1;
surf(X2,Y2,Z2);
[X3 Y3 Z3] = makeCylinder(20, 1, 'z');
Z3 = Z3 - 1;
X3 = X2 + 10;
surf(X3,Y3,Z3);
[X4 Y4 Z4] = makeCylinder(5, 1, 'z... |
function foo()
disp('foo')
end
|
function g = sigmoid( z )
g = 1./(1 + exp(-z));
end
|
%% Demo: Simulating Fading Channels
% MATLAB has many excellent routines for simulating various
% multi-path fading models. In going through this demo
% you will learn to:
%
% * Simulate fractional delays using the DSP toolbox
% * Describe multi-path channels with arrays of delays and angles
% * Plot the time-varyin... |
function tracker = up_dico_beta4(tracker,sig_up, threshold)
% Hint: threshold could be taken from opt.thres_occ
% wimg0 = tracker.wimg;
% wimg1 = circshift(wimg0,1,1);
% wimg2 = circshift(wimg0,1,2);
% delta_x = wimg0 - wimg2;
% delta_y = wimg0 - wimg1;
% grad_img = sqrt(delta_x.^2 + delta_y... |
function varargout = calculator(varargin)
% CALCULATOR M-file for calculator.fig
% CALCULATOR, by itself, creates a new CALCULATOR or raises the existing
% singleton*.
%
% H = CALCULATOR returns the handle to a new CALCULATOR or the handle to
% the existing singleton*.
%
% CALCULATOR('CALLBACK'... |
function peak_check = plot_SWR_multi( R, LFP_grid, I,J,seg_ind )
% -1 for no figure, 0 for displaying figure, 1 for saving figure
%
% If the firing history is too long, data will be segmented into several
% history fractions and plotted separately.
disp('plot_SWR_multi...');
dt = R.dt;
fs = 1/(dt*1e-3); % samp... |
function status = draw_Trajectory(Trajectory)
t = plot(Trajectory.x, Trajectory.y,'c-o');
%set(t,'LineWidth',1.5);
set(t,'LineWidth',5); |
clear; close all;
D = 3; verbose = false;
num_parameters = 26;
%% Hmodel
input_path = '_my_hand/fitting_result/';
semantics_path = '_my_hand/semantics/';
output_path = '_my_hand/tracking_initialization/';
data_path = '_data/hmodel/';
load([semantics_path, 'tracking/names_map.mat']);
load([semantics_path, 'tracking/nam... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NAME: Alexander Price
% JMU-EID: priceat
% DATE: January 24, 2013
%
% PROGRAM: maxcollatz.m
% PURPOSE: Prints the collatz sequence with the largest length of an
% integer between 1 and 1000
% CREDIT:
%
% VARIABLES:
% n = max integer to collat... |
% The script takes a performance.RT vector
% and randomly samples
function performancesRT_smooth = plotBoost(performancesRT)
performancesRT_smooth = performancesRT;
for n = 1:(1000)
sampled_idx = randi([1 length(performancesRT_smooth)-1]);
new_value = mean([performancesRT_smooth(sampled_idx) performanc... |
function result = coefficient_fun_c1(x,t)
result = 1;
end |
%{
Theodore Bastian
tab111
%}
%set initial values for each reservoir
atmosphere(1)=750;
terrestrialBiosphere(1)=600;
oceanSurface(1)=800;
deepOcean(1)=38000;
soil(1)=1500;
emissions(1)=5;
%set values for each flux
terrestrialPhotosynthesis=110/atmosphere(1);
marinePhotosynthesis=40/atmosphere(1);
terrestrialRespirat... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2012 Analog Devices, Inc.
%
% 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:/... |
function visualizeOMPLRobot
clear all
close all
global lengths
global n
lengths = [1]; %, 1, 1];
goal = [2]; %[-1.13; -1.57; 1.57];
n = 1;
pit = load('SinglePathCalc.mat');
X = pit.statePath'
% for i = 1:n
% X(i,:) = pit(:,2*i - 1);
% end
t = size(X,2);
... |
clc; clear all; close all;
path='fa2_L/'; % Training images folder
query_path = 'fb_L/'; % Query images folder
[training_data,training_labels,shape] = getData( path );
h=shape(1);
w=shape(2);
average_face = averageFace(training_data);
At=normalizedData(training_data,average_face);
A=At';
[u,l]=eigenFaces(At);
[M,N]=... |
function f= rdcreg3(b,wx,y)
% the appoximated objective function using LQA.
global H;
global lambda
g=DistCorrVec(wx*b,y);
f=-g + 0.5*lambda*trace(b'*H*b);
return; |
function [Cd,S] = CdRocket(h,t)
Cd = .6; %Rocket Cd
S = pi*(2*2.54/100)^2;
end |
function [T1s PDs RMS]=CalcT1byFAfwSin(Data,FAs,TRs)
% Data - nFAs x nSamples
% FAs - Row vector
T1Max=40000;
TR=TRs(1);
SinFAs=sind(FAs)';
CosFAs=cosd(FAs)';
n=size(Data,2);
C=Data.*((repmat(CosFAs,1,n)));
X=zeros(2,n);
% M(:,1:2:n*2-1)=C;
% M(:,2:2:n*2)=repmat(SinFAs,1,n);
% X=pinv(M)*Data;
CurM=[C(:,1) SinFAs];
RMS... |
adjA=[A(2,2), -A(1,2);-A(2,1), A(1,1)];
detA=A(1,1)*A(2,2)-A(1,2)*A(2,1);
invA=adjA/detA;
disp('detA');
disp(detA);
disp('invA');
disp(invA); |
function varargout = configBrowser(obj,varargin)
% CONFIGBROWSER Generate Interpolated Magnetic Configurations
% CONFIGBROWSER(confArray) processes an input mConf array, containing at
% least two elements, as magnetic configurations sampled uniformly on an
% arbitrary one-dimensional parameter space. This paramet... |
function [rbump,hs,vs]=BumpAtBPM(ring0,inCOD,bumph,bumpv,indBPMbump,indHCor,indVCor)
% function roff=BumpAtBPM(...
% ring0,... AT lattice structure
% inCOD,... initial 6x1 coordinate guess
% bumph,... hor. bump value at indBPMbump
% bumpv,... ver. bump value at indBPMbump
% indBPMbump, bump positio... |
clear;
clc;
close all;
%游标fetch的方法获取数据
conn = database('data', 'root', '66196619', 'com.mysql.jdbc.Driver', 'jdbc:mysql://localhost:3306/data');
curs = exec(conn, 'select * from data.his_etf limit 100');
dbdata = fetch(curs);
cur = dbdata.Data;
symbol = cur(1,1)
date = cur(1,2)
close(curs);
close(conn);
%数据库fetch的方法获... |
function C = adj2cluster_mp(A)
% http://raphael.candelier.fr/?blog=Adj2cluster
% Symmetrize adjacency matrix
S = A + A';
% Create fully-connected subnetworks
P = S;
R = S;
i = 1;
while true
P = P*S;
T = R + P;
if any((T(:))~=(R(:)))
R = T;
... |
function varargout=getbldata(bl,navg,dwell)
%=============================================================
%function varargout=GetblData(bl,navg,dwell)
%acquire photon BPM signals for SPEAR for all beamlines
%values returned in bl structure
%varargout=GetblData(bl,navg,dwell)
navg=1;
dwell=1;
bl(2).iopen=getam('blOpen... |
function [x] = SST(A, b)
[n, n] = size(A);
x(n,1) = b(n,1) / A(n,n);
for i = n-1 : 1
x(i, 1) = (b(i, 1) - A(i, i+1:n) * x(i+1:n, 1)) / A(i,i)
end
end
|
clear all;
clc;
tic;
% SOLVER OPTIONS
verbose = 1;
tolerance = 1e-8;
% OUTPUT OPTIONS
reoptimize = 1; % this option should be set to 1 for the two-step
% optimization procedure (see (3) in the paper)
tol_reopt = 1e-5; % tolerance in the re-optimization process ... |
function [VOITC] = px_spm8_voi(fdp, para)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Format [VOITC] = px_spm8_voi(fdp,para)
% Usage This function was used to extract time course from a specific
% sphere or mask template.
% Input
% fdp.P - The fullpath of the imag... |
% MJLEXC.M
% Excitation pulse (magnetization to transverse)
% Called by mjljm
mjlexv = get(mjluiex, 'Value') ;
if mjlexv == 1 ;
set(mjluiex, 'BackGroundColor','white') ;
set(mjluiis,'Value',0, 'BackGroundColor',...
[0.501961 0.501961 0.501961]) ;
mjlisv = 0 ;
set(mjluise,'Value',0, 'BackGroundColor',...
[... |
function out = jacobian(in)
% nvector = size(in(1).value,1);
% j = size(in,2);
% out = sparse(size(in,1),size(in,2));
out = [];
for i=1:size(in,2)
for j=1:size(in,1)
out = [out;in(j,i).dV];
end
end
end |
function [x, out] = l1_auglagrange_dual(x0, A, b, mu, opts)
[m, n] = size(A);
pseudomu = 10000*mu;
beta = opts(1);
gamma = opts(2);
maxIter1 = opts(3);
maxIter2 = opts(4);
tol = 1e-6;
x = zeros(n, 1);
y = zeros(m, 1);
%continuation trick
while pseudomu >= mu
iter1 = 1;
while iter1 < maxIter1
% y ... |
function [boundingBox, extent] = voxelBox(neuron, voxelSize)
if isempty(neuron.model)
neuron.build();
end
boundingBox = getNeuronBounds(neuron);
extent = diff(boundingBox')';
for i = 1:3
boundingBox(i, 2) = boundingBox(i, 2) + ...
(voxelSize(i) - rem(extent(i), vo... |
function result=distort_image(I,type)
if type==1
%Sinusoid Distortion
[nrows,ncols] = size(I);
[xi,yi] = meshgrid(1:ncols,1:nrows);
a1 = 10; % Try varying the amplitude of the sinusoids.
a2 = 7;
imid = round(size(I,2)/2); % Find index of middle element
u = xi ... |
function file_datenum = filedatenum(fname)
% <cpp> Purpose: Returns the modification date (datenum) of a file
% Usage: file_datenum = filedatenum('myfile.dat')
% Author: Charles Plum, Varolii Corp, 21 August 2009
%*********************************************************************
% Extract the file path fro... |
function detectSaccades(varargin)
%Notes: this function is in development. Right now, varargin isn't doing
%anything and all the parameters are being hard-coded below. Later the
%argument handling will be implemented. -ACS 25Oct2012
global aio calibration;
threshold = 10; %in degrees/sec
startTime = tic;
while toc(... |
clear all;%clear the workspace
close all; %close all windows
im1=double(imread('lenna256_c','tif')); %read the lenna image
im2=double(imread('baboon256_c','tif')); %read the baboon image
figure(1),clf;
imshow(im1/255);
pause
figure(2),clf;
imshow(im2/255);
pause
%%%%%%%%%%%%%%%%%%%
[ymax, xmax, c] = size(im1); %ge... |
%高阶有自衡对象辨识
clc;
clear all;
close all;
load wtankjy;
TA=clock;
Y1=Y;
[lp,m]=size(Y1);
if lp<m
lp=m;
end
[v1,v2,v3,v4,v5,v6,v7]=value(Y1,dt);
ys=v6;
k=ys;
T04=ys*0.4;
T08=ys*0.8;
e04=zeros(lp,1);
e08=zeros(lp,1);
for i=1:lp
e04(i)=[Y1(i)-T04]*[Y1(i)-T04];
e08(i)=[Y1(i)-T08]*[Y1(i)... |
% at06_04[script]
% outro metodo para gerar a imagem de magnitude pode ser encontrando o valor
% máximo entre a vertical e a horizontal
clear all, close all, clc;
g = imread('cameraman.tif');
g = im2double(g);
S = fspecial('sobel');
gH = imfilter(g,S,'replicate','conv')
S = S'
gV = imfilter(g,S,'replicate','conv... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2012 Analog Devices, Inc.
%
% 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:/... |
function [Q,T] = forward_kinematics(C,BE,P,dQ)
% Compute absolute transformations from FK hierarchy and relative bone
% rotations.
%
% Inputs:
% C #C by dim list of joint positions
% BE #BE by 2 list of bone edge indices
% P #BE list of parent indices into BE
% dQ #BE by 4 list of relative r... |
function append_lat_long(plt_TE_emis, plant_coord, poll)
%% DESCRIPTION NEEDED
%% determine median phase emis for each plant
emf_med = zeros(size(plt_TE_emis,1),3);
emis_med = zeros(size(plt_TE_emis,1),3);
for i = 1:size(plt_TE_emis,1)
emf_med(i,:) = median(plt_TE_emis.emf_mg_MWh{i,1},'omitnan');
emis_med... |
function retval = boundary_vertices_m(HEObj,varargin)
if isempty(varargin) || isempty(varargin{1})
b = 1:nob(HEObj);
else
b = varargin{1};
end;
bv = boundary_vertices(HEObj,b);
if ~iscell(bv)
bv = {bv};
end;
maxfs = max(double(HEObj.BFS(b)));
retval = zeros(length(b),maxfs);
for i=1:length... |
function showex(ipAddress)
% function showex(ipAddress)
%
% main Ex function
%
% ipAddress: the IP address of the remote Ex machine
%
%
while CharAvail;
GetChar;
end
global u;
global objects;
if nargin == 0
ipAddress = '192.168.1.11';
end
Screen('Preference', 'SkipSyncTests', 0);
gam = load('photometervals... |
function [ww] = ellipticMap(a,b,N)
N(1:2)=N;
f=sqrt(a^2-b^2);
xi0=acosh(a/f);
x=linspace(0,xi0,N(1));
y=linspace(0,2*pi,N(2));
[xx,yy]=ndgrid(x,y);
zz=xx+1i*yy;
ww=f*cosh(zz);
end |
function [cnames,keffP,keffM,dra,fda]=stabtable(fnames);
% [cnames,keffP,keffM,dr,fd]=stabtable(fnames);
% sammanställer resultaten från matstabfiler
% exempel stabtable('dis*ned.mat')
% stabtable({'stab1.mat','stab2.mat'})
if ~iscell(fnames)
fnames=expand(fnames,'mat');
d=dir(fnames);
[filelist{1:leng... |
% Copyright (c)2013, The Board of Trustees of The Leland Stanford Junior
% University. All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are
% met:
%
% Redistributions of source code must retain the... |
function [ColorOfIndicator,BlueprintArray,CSArray,A,CofCS,CofBot,StartCofCS]=Pixelete(r,count)
ArrenaGrid=zeros(8,8); % defining a 8,8 blank matrix///converting arrena in a grid of 8,8
A=ArrenaGrid;
Arrena=imread('arrena2.jpg');
resizedArrena=imresize(Arrena,[4... |
function [BasePnk mixture1 likelihood] = EStepx(mixture, pixels)
% EStep perform the E-step of the EM algorithm
% 1) calculate pnk = Prob(Xn=k|Yn=yn, theta)
% 2) calculate likelihood = log ( prob(Y=y|theta) )
[N M] = size(pixels);
K=mixture.K;
pnk=zeros(N,K);
for k=1:K
Y... |
clc
clear
close all
Fs=48000;%%%采样率
t=0:1/Fs:0.02;%%时长
f=1500;
w=2*pi*40;
x=sinc(w*t).*exp(1i*2*pi*f*t); %x信号
x=awgn(x,20);
figure
plot(t,abs(x));
tt=-0.01:1/Fs:0.03;
ff=2000;
x_delay=sinc(w*tt).*exp(1i*2*pi*ff*tt); %x信号
x_delay=awgn(x_delay,20);
figure
plot(tt,abs(x_delay));
%%%时差为0.01 频差为-500
xor_len=... |
% Template to write a script for the NIAK fMRI preprocessing pipeline
%
% To run a demo of the preprocessing, please see
% NIAK_DEMO_FMRI_PREPROCESS.
%
% Copyright (c) Pierre Bellec,
% Montreal Neurological Institute, McGill University, 2008-2010.
% Research Centre of the Montreal Geriatric Institute
% & Departm... |
function A = MxMake_1781(mx_id,n)
if strcmp(mx_id,'had'),A=hadamard(n);end
if strcmp(mx_id,'trihad'),A=triu(hadamard(n));end
if strcmp(mx_id,'toep'),A=toeplitz([4,-1,zeros(1,n-2)]);end
if strcmp(mx_id,'mc'),
for i=1:n
for j=1:n
if i==j,A(i,i)=1+i;else
A(i,j)=1/abs(i+j)^2;end
... |
clear
clc
load('E:\Machine Learning\Final Project\kit_latest\kit\train\train.mat');
load('E:\Machine Learning\Final Project\kit_latest\kit\test\test.mat');
net_training_sum=sum(words_train);
net_training_zero=find(~net_training_sum);
net_training_nonzero=find(net_training_sum);
words_train=words_train(:,net_training_n... |
function Radius_Error = engine_52(delta)
%This function takes in Delta value (from an initial TARGET guess). See line
%479 of nonlin.m. And updates the reqd. global variables. nonlin then stores the data in an array for each
%speed and delta (481 onwards).
%This subfunction computes vehicle dynamics of a 2 DOF system... |
function [xa,xb,xc,fa,fb,fc,sa,sb,sc] = mnbrak(f,xa,xb,fa,fb,sa,sb);
GOLD = 1.618034;
GLIMIT = 100;
TINY = 1.0e-20;
%[fa,sa] = feval(f,xa,state);
%[fb,sb] = feval(f,xb,state);
if (fb > fa) % swap
t = fa; fa = fb; fb = t;
t = xa; xa = xb; xb = t;
t = sa; sa = sb; sb = t;
end;
xc =... |
clear all
close all
clc
% This code means to remove remain root hairs after segmented by level set
%
%%
TEMPLATE_TYPE = 'Test'; % 'Equal' 'Origin' 'Test'
VIDEO_SEQ = 'Antoine 8';
saveContour = true;
imageTypeLoad = 'png';
imageTypeSave = 'png';
contourFileType = 'txt';
START = 176;
END = 176;
offset = 1;
visualised ... |
clear;
close all;
clc
uData = idinput(2000,'rbs',[0 0.1],[-1 1]);
uData = [(0:1999)' uData(:)];
s = tf('s');
sysc = 1/(s+1);%1/(s^2+s+1);%(s^2+3*s+2)/(s^3+2*s^2+s+1);
sysd = c2d(sysc,1);
sysd.Variable = 'z^-1';
num = cell2mat(sysd.num);
den = cell2mat(sysd.den);
Ts = sysd.Ts;
R = input('Now execute and h... |
function [LCV,status]=LeastCoreVertices(v,tol)
% LEASTCOREVERTICES computes the vertices of the least core of game v.
%
% Usage: [crv,fmin,status]=LeastCoreVertices(v,tol)
%
% Define variables:
% output:
% Fields of LCV:
%
% crv -- Matrix of core vertices. Output is numeric.
% crst -- The core constra... |
function [a,y_fit,Sa,Sy_fit,R2,Ca,condX] = mypolyfit(x,y,p,b,Sy)
% [ a , y f i t , Sa , S y f i t , Ca , condX ] = m y p o l y f i t ( x , y , p , b , Sy )
%
% f i t a power−p o l y n o m i a l , y f i t ( x ; a ) t o d a t a p a i r s ( x , y ) where
%
% y f i t ( x ; a ) = SUM i=1 ˆ l e n g t h ( p ) a i xˆ p ... |
function likelihood = loglikelihood(data, mu, Sigma, pi_k)
n = size(data,1);
k = size(pi_k,1);
piece = zeros(n,k);
for i = 1:k
piece(:,i) = pi_k(i) * normal(data, mu(i,:), Sigma(:,:,i));
end
likelihood = sum(log(sum(piece,2)));
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 mRes = idAuxMatrResizeExt(m, newSizeDim1, newSizeDim2, iStartDim1, iStartDim2)
sizeDim1 = size(m, 1);
sizeDim2 = size(m, 2);
if((iStartDim1 < 1) || (iStartDim1 > sizeDim1))
fprintf('Incorrect start index value');
end
if((iStartDim2 < 1) || (iStartDim2 > sizeDim2))
fprintf('Incorrect start index value... |
%@(#) tipshow.m 1.3 05/12/12 15:57:12
%
function tipshow
hvec=get(gcf,'userdata');
valfil=get(hvec(length(hvec)),'userdata');
nfiles=size(valfil,1);
hfil=hvec(length(hvec)-nfiles+1:length(hvec));
hand=get(hvec(length(hvec)-nfiles),'userdata');
ll=length(hvec)-nfiles-1;
hwin=gcf;
hpar=hvec(ll+1);
hand=get(hpar,'u... |
function [uname1,id1,uname2,id2] = myUname()
% please update your user name and Id .
uname1 = 'adirn';
id1 = '201206612'; % fill your ID as a string
uname2 = 'guyshanny';
id2 = '203788716'; % fill only if handed in by two students.
if (str2num(id2) >0)
disp([ ' uName1: ' uname1 ' id: ... |
function[pr]=prime(m,n)
% This script finds all of the prime numbers between inputed number m and
% inputted number n if they are both positive intgers and n is greater than
% m
%m=input('Enter m:');
%n=input('Enter n:');
% displays errors if the inputs do not fit the criteria of positive
% integers and n is... |
%book: Signals and Systems Laboratory with MATLAB
%by Alex Palamides & Anastasia Veloni
% how to plot the FS coefficients
%x(t)=exp(-t),0<t<3
syms t k n
x=exp(-t);
% complex exponential coefficients
t0=0;
T=3;
w=2*pi/T;
a=(1/T)*int(x*exp(-j*k*w*t) ,t,t0,t0+T)
k1=-6:6;
ak=subs(a,k,k1);
stem(k1,ab... |
function[xm, cod]=biseccion(f,xo,xi,tol,maxit)
%Esta función calcula una aproximacion de la raíz de una función por el método de la Bisección, que consiste en subdividir un intervalo dado evaluando cambios de signo de la función.
error=inf;
cant=0;%Almacena la cantidad de iteraciones.
f=inline(f);
cod=0;%Indica si... |
%%
[training_in, testing_in] = split(AppleFeat,BananaFeat);
[train_dissimilarities] = dissimilarity(training_in);
[test_dissimilarities] = dissimilarity(testing_in);
% make prdatdaset
training_data = prdataset();
testing_set = prdataset(); |
function [imw,imn] = whitenAndFilterSoundclip(im,a,b,RF_size)
[N,M] = size(im);
imf=fftshift(fft2(im));
fxx=-M/2:M/2-1;
fyy=-N/2:N/2-1;
[fx, fy] = meshgrid(fxx,fyy);
if a>0 && b>0
fx = fx/a;
fy = fy/b;
[theta, rho]=cart2pol(fx,fy);
% filtf = rho;
filtf = rho.*exp(-0.5*(rho/(0.7*N/2)).^2);
figure(8);
imagesc(f... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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#... |
%多项式的四则运算
%a=[a(1),a(2),..,a(n),a(n+1)]
a=[2,4,6,8]
b=[3,6,9]
c=a+[0,b]%相加,位数补齐
d=conv(a,b)
[q,r]=deconv(d,a)
[q,r]=deconv(a,b) |
function rgb = plum
rgb = [0.86666, 0.62745, 0.86666];
end |
function [coefficients] = hanning(n)
%% Calculate the coefficients for a Hanning window
% :param n: number of points in the window.
% :return: The Hanning window coefficients.
%
% Created by: Lee A. Harrison
% On: 4/26/2019
%
% Copyright (C) 2019 Artech House (artech@artechhouse.com)
% This file is part... |
% compute pairwise distances
perm1 = zeros(N*(N-1)/2,1);
perm2 = zeros(N*(N-1)/2,1);
perm3 = zeros(N*(N-1)/2,1);
k = 1;
for i = 1:N-1
for j = i+1:N
perm1(k) = i;
perm2(k) = j;
perm3(k) = N*(i-1) + j;
k = k+1;
end
end
d = size(X,2);
if (d > 1)
temp = sum((X(perm1,:) - X(perm2... |
%% Question 1
% Use matlab to plot the following discrete time signals
% our range is from -10 to 10
n = -10:10;
% 1a) x[n] = u[n] -2u[n-1] + u[n-4]
ya = unitstep(n) - 2.*unitstep(n-1) + unitstep(n-4);
ya;
% 1b) x[n] = (n+2)u[n+2] -2u[n] -nu[n-4]
yb = (n+2).*unitstep(n+2) - 2.*unitstep(n) -n.*unitstep(n-4);
yb;
%... |
function [phi,theta]=orthToAng(v1)
% function to convert a vector to the angles of spherical coordinates.
%CTERun License
%Copyright (c) 2012, The Kriven Research Group. All rights reserved.
%Redistribution and use in source and binary forms, with or without
%modification, are permitted provided that the followi... |
function d = distancePointLine3d(point, line)
%DISTANCEPOINTLINE3D Euclidean distance between 3D point and line.
%
% D = distancePointLine3d(POINT, LINE);
% Returns the distance between point POINT and the line LINE, given as:
% POINT : [x0 y0 z0]
% LINE : [x0 y0 z0 dx dy dz]
% D : (positive) scal... |
function output = newReleaseUpdate(timeSinceSpike, miniFreq, epsilon, N_pre)
%NEWRELEASEUPDATE - Calculate time until next Mini release
%
% This function is how we calculate new values of the state variable
% `newRelease` for the 'Mini'-type synaptic mechanisms in the DynaSim
% implementation of (Krishnan et al., 2016)... |
function v=min_game(lam)
% MIN_GAME(lam) generates a minimum game. Every market game can be
% represented as a minimum game.
%
% Source: E. Kalai and E. Zemel, Generalized Network problems yielding
% totally balanced games, Operations Research Vol. 30, pp. 998-1008 (1982)).
%
% Usage: v=min_game(lam)
%
% Define variab... |
function md = ress2res(ress)
k = 0;
for td = -100:ress:100 % percent diffrence in speed
[x,y] = xy(td);
figure(1)
plot(x,y,'-');
hold on
plot(x(end),y(end),'o');
axis equal
if td > -90
d(k) = sqrt((x(end)-x_old)^2+(y(end)-y_old)^2);
end
x_old = x(end);
y_old = y(e... |
%% Clean
close all
clear all
dspflag = false;
%% Files & Directories
% Change to your own liking
cd('/Users/marcw/DATA/Student/Marleen/DATA')
fname = 'MH-RG-2015-01-09-0005';
fname = 'RG-MH-2015-01-14-0002';
% cd('/Users/marcw/DATA/Student/Marleen/DATA')
% fname = 'RG-MH-2015-01-09-0003';
% cd('/Users/... |
function Avanzar(mod)
global Riel
vect_riel = getfield(Riel, 'translation');
if mod == 1
Riel.translation = [(vect_riel(1,1)+0.01) vect_riel(1,2) vect_riel(1,3)];
elseif mod == 2
for r = vect_riel(1,1):-0.01:-5
Riel.translation = [ r vect_riel(1,2) vect_riel(1,3)];
... |
function [t0,fit]=WeightedPhaseFit(t,x,y)
phi=unwrap(atan2(y(:),x(:)));
duration=(t(end)-t(1));
q=(t(:)-t(1))/duration;
weight=x.^2+y.^2;
weight=weight/max(weight);
numpoints=numel(q);
order=3;
matrix=ones(numpoints,order+1);
for column=1:order
matrix(:,column+1)=q.^column;
end
vector=phi;
matrixw=matrix;
for r... |
function [F, partialF, support] = gaussIntegration(f, a, b, nDivisionLevel, nNodes)
%GAUSSINTEGRATION uses Gauss nodes to integrate real-valued function
% uses a Gauss integration rule on the interval [a, b]
% with nNodes (usually 4 nodes) on the corresponding interval
% nDivisionLevel uses gauss integrati... |
function [pass,maxerr] = test(opt)
% Check that winlowpass works with forward-backward filtering
dt = 0.5e-9;
nu1 = 0.5e9;
N = 300;
t = linspace(0,dt*N,N);
signal = exp(-5e7*t).*(cos(2*pi*nu1*t));
% signal = signal/signal(1);
sampl = 1/2*(1/dt);
% ws = 4e8;
wp = 0.01e9;
ws = 0.04e9;
filteredS1 = win... |
classdef NoisyModelRealCar < CtSystem & InitDeinitObject & ParameterizedCtSystem
% 'Parameters' [kv,kd,gv,gdelta]
% dx = [
% cos(x(4)+beta(x))*x(3); %xDot
% sin(x(4)+beta(x))*x(3); %yDot
% -kv*(x(3)-gv*u(1)) ; %vDot (first order model approximation)
% (x(3)/lr)*sin(beta(x)... |
function [ACC_res NMI_res]=TSS(sourceFeature,targetFeature,targetLabel)
% =====================
% Learning Transferable Subspace for Human Motion Segmentation
% =====================
% Author: Lichen Wang
% Date: Nov. 12, 2018
% E-mail: wanglichenxj@gmail.com
% Input: Source video frame-level feature (d*N_s), ... |
%SOLVER.m
%pro while vars
zx=1;
zy=1;
zz=1;
%
z=zeros(41,41);
Y=zeros(61,2);
for a=[-1:0.05:1]
for b=[-1:0.05:1]
for c=[-1:0.05:1]
[~,Y] = ode45(@rr3, [0 8],[a b c]);
z(zx,zy,zz) = sum(abs(Y(:, 1)));
zz = zz+1;
end
zy=zy+1;
zz=1;
end
zx = zx+1;
zy ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.