text stringlengths 8 6.12M |
|---|
syms x
y=sin(x);
yl=diff(y,3) |
function [R, row, col] = harris(im, sigma, thresh, radius, disp)
im = imread(im);
im = rgb2gray(im);
error(nargchk(2,5,nargin));
dx = [-1 0 1; -1 0 1; -1 0 1]; % Derivative masks
dy = dx';
Ix = imfilter(double(im), double(dx)); % Image derivatives
Iy = imfilter(double(im), doub... |
function varargout = fitthreecircles(varargin)
%FITTHREECIRCLES Fits three circles on a curve.
% FIT = FITTHREECIRCLES(M,X0,'PARAM1',VALUE1,'PARAM2',VALUE2,...) tries
% to fit three circles on the cartesian curve given in argument. The
% center of the big circle is not allowed to vary, but r its radius, r1
% a... |
% same comments as part e. Only change is the kernel function
words = importdata('vocabulary.txt');
stoplist = importdata('stoplist.txt');
train =importdata('train.data');
train_label = importdata('train.label');
valid = find(~ismember(words,stoplist));
valid_train = find(ismember(train(:,2),valid));
updated_train =... |
% Industrial Electronics Assignment
% Sambhav R Jain
% 107108103
clc;
clear all;
close all;
fprintf('Performance Analysis of a single phase separately excited DC motor drive - Analytical Solution\n');
fprintf(' - Sambhav R Jain (107108103)\n\n');
% fprintf('Enter the following parameters:\n');
% V = input('Supply rm... |
% demonstrate basic I/O in matlab (pg 335)
%
% This is a comment
x=input('Enter a number: ');
y=input('Second number: ');
z=x/y;
disp('Their ratio is ');
disp(z);
|
clc;clear;close all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This swarm controller is based on
% Distributed UAV Swarm Formation Control via
% Object-Focused, Multi-Objective SARSA
%
% This work was started by David Stier on 2/20/2019
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Begin Initialization
%%%%%%%... |
function Duval_v7
% Duval's Triangle
% F. Andrianasy, Mercredi 04 Mai 2011
% F. Andrianasy, Vendredi 13 Aout 2010
%clc
clear
whos
% -----------------------------------------------
% Initialisations
% -----------------------------------------------
global TRG_SCALE
global S_TRG
global A
global B
gl... |
function locate_deps
PATHS=...
{
'.';
'./SUBS';
'./SUBS/mexcdf/mexnc';
'./SUBS/mexcdf/snctools';
};
for path=PATHS'
addpath(genpath(path{1}))
end
dbstop if error
rehash
end
|
%% Generate simulations with user-specified scheme
%{
This script produced numerical simulations of the Cahn-Hilliard equation
for a specific user-specified scheme.
Author: Matthew Geleta
Date: 19/03/2017
%}
%% Fix parameters for simulations
N = 50; % Number of spatial steps in one-dimension
T = 100; % Number of time... |
P = [ 0.5 -0.7 +0.6 -1.0; 0.8 -0.3 -0.4 +0.9];
T = [1 0 1 0];
plotpv(P ,T);
net = newp([-1 1;-1 1],1);
plotpv(P ,T);
plotpc(net.IW{1},net.b{1});
figure
net.adaptParam.passes = 3;
net = adapt(net,P,T);
plotpc(net.IW{1},net.b{1});
p = [0.7; 1.2];
a = sim(net,p);
plotpv(p,a);
point = findobj(gca,'type','line');
set(p... |
function change_stack_basepath(stack_name, old_path, new_path)
% function change_stack_basepath(stack_name, old_path, new_path)
% Change the basepath for a stack
% stack_name: filename for loading the stack
% old_path: basepath that needs to be replaced (e.g. /path/to/old/files/)
% new_path: basepath where the files ar... |
function plusOneFrame_Callback(hObject, eventdata)
global vid_fig_hand;
global vid_obj;
curr_frame = get(vid_fig_hand.frameEdithandle, 'String');
curr_frame = str2num(curr_frame);
frameMinusTen = curr_frame -10;
updateFrameFunction(frameMinusTen, vid_obj);
end |
[mnis,corrs] = getMNI ;
[meancomps,fmri] = isolateComponent ;times = load('times') ; times = times.times ;
meancomps = meancomps(:,:,1:110,:) ;
stimtypes = {[1,3,2],[1,5,6]} ;
typenames = {'contrast','randomization'} ;
allnames = {'unperturbed','5%contrast','33%contrast','plaid','10%randomization','60%randomizat... |
function [a] = PMM_boundary_conditions(La, tau, N_intervals, N_basis, N, n)
%{
N_intervals = number of intervals
N_basis(i) = number of basis functions on interval i
%}
N_total = sum(N_basis); %total number of basis functions
N_max = max(N_basis);
N_total_3 = N_total - N_intervals;
p = zeros(N_max,1); %n-th Gege... |
%this is how you filter values from the x array
%as well as the y array at the same time
%necessary because numbers may be imaginary
x = [ 1, 2, 3, 4, 5, 6, 7 ];
y = [ 10, 6, 3, 1, 0, -0.5, -0.7]
%subplot(1, 2, 1), plot(x, y,'*')
%subplot(1, 2, 2), plot(x, ln_y, '*')
%the plots above cause problems because the
%y... |
% cov192D.m
clear
close all
clc
% Population N2
N = 5;
N2 = N^2;
% location
% x = randi([1 N],N,N);
% y = randi([1 N],N,N);
x = 1:N;
[xx, yy] = meshgrid(x,x);
figure(1)
Hplot = plot(xx,yy,'ok');
set(Hplot,'markersize',6,'markerfacecolor','k');
|
%% set directory paths
setupPaths;
addpath(mDir);
%% check if analysis is interrupted
if exist([workDir inputName '\' inputName '.start'], 'file')
itStart = textread([workDir inputName '\' inputName '.start'], '%d');
delete([workDir inputName '\' inputName '.start']);
else
itStart = 0;
end;
%% creates fol... |
%% PEB
%% Collate DCMs into a GCM file
GCM_maju = {
'maju_01_modelFull.mat';
'maju_03_modelFull.mat';
};
GCM_saco = {
'saco_01_modelFull.mat';
'saco_03_modelFull.mat';
};
GCM_sege = {
'sege_01_modelFull.mat';
... |
function [bbs] = GridImg(img, CROP_SIZE_H, CROP_SIZE_W)
[h,w,~]=size(img);
num_h = ceil(h/CROP_SIZE_H)*2;
num_w = ceil(w/CROP_SIZE_W)*2;
for i=1:num_h
y_end(i) = CROP_SIZE_H + round((i-1)*(h-CROP_SIZE_H)/(num_h-1));
y_start(i) = y_end(i) - CROP_SIZE_H + 1;
end
for i... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function doTestColorDistance
% Batch test of color distances
%
% Input parameters:
%
% Output parameters:
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function doTestColorDistance
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
%switch
%注意这里输入空或非空的error Detection
n=input('n=')
switch rem(n,2)
case 1
A='odd'
case 0
A='even'
otherwise
A='error'
end
|
function a = Triangle(n)
% Given a number n this function
% will spit out the triangle number.
% Maybe it will also spit out the triangle.
number=n;
sum_val=0;
for i= 1:number
x = [1:i];
display(x);
clear x;
sum_val = sum_val+i;
end
display(sum_val);
end
|
function [sys,x0,str,ts] = camera_anim(t,x,u,flag)
%CAMERA_ANIM S-function for animating the live image of an eye in hand cam.
%
% The 8 components of the vector u are the coordintaes of 4 points.
%
% Copyright 2012 Jacques Gangloff (jacques.gangloff@unistra.fr)
% $Revision: 0.1 $
% Plots every major integratio... |
clear
clc
tic
%读取图的邻接矩阵
AvgW=0;
TotalV = 0;
vert = 150;
edg = 3000;
NIND = 40;%种群大小
MAXGEN = 200;%最高代数
for du = 1:1
str = strcat ('C:\Users\ASUS\Desktop\毕设\数据\mvcp3数据\newtu\n',int2str(vert),'m',int2str(edg),'gn\tu', int2str(du) , '.txt') ;
A = textread(str);
n = A(1,1);
m = A(1,2);
W = A(2,:);
X = A(3:n... |
function output=energy_response_fluo(input_photon_energy, threshold_energy_vector, ...
K_fluorescence_energy, fluo_distance, electron_radius, electron_noise_in_kev,detector_pixel_size_in_um)
%function output=energy_response_fluo(input_photon_energy_in_kev, threshold_energy_vector_in_keV, ...
% K_fluorescence_ene... |
function[]=MS2_macroImageJ_OrthViews(Path,File,manual,Channel1, Channel2)
% BEFORE START DO manual = true
%%
if manual == true
[File,Path] = uigetfile('*.*','select file for name / MAX.tif','/Volumes/Mac OS/MS2/');
Name = '_3D/'
Nickname='m5m8peve gap43mCh'; Rep = 2; SplitEarly = 15; Channel1 = 'MCP'; Cha... |
clear all
clc
k_dc = 5;
Tc = 10;
u = 2;
% Create Continous time transfer function
% s = tf('s');
% G = k_dc/(Tc*s+1)
%Create dicrete time transfer function
%Sampling time 30 milliseconds
%Gdot=c2d(G,30/1000,'zoh')
Gdot = tf([1 0], [1 -.9],30/1000); % in terms of z, not z^-1
%Step Function input
input_signal = [ze... |
function hpol = polplot(theta,rho,line_style,maxRsp,scalebar)
% POLPLOT Polar coordinate plot.
% POLPLOT(THETA, RHO) makes a plot using polar coordinates of
% the angle THETA, in degrees, versus the radius RHO.
% POLPLOT(THETA,RHO,S) uses the linestyle specified in string S.
% See PLOT for a description of leg... |
%horizontal and vertical response matrix at BPM locations
%by changing corrector strengths
sp3v81resp
%BPM locations
bpmfam = FINDCELLS(FAMLIST, 'FamName', 'BPM');
bpname=FAMLIST{bpmfam}.FamName;
ntbpm=FAMLIST{bpmfam}.NumKids;
disp(bpname);
disp(ntbpm);
BPMI=FAMLIST{bpmfam}.KidsList;
%corrector locations/number 2 in f... |
clear all;
close all;
clc;
%% Filtro passa baixa
fp = 941;
fs = 1209;
fa = 8000;
fN = fa/2;
Ap =1;
As = 20;
Wp = fp/fN;
Ws = fs/fN;
[n,Wn] = buttord(Wp,Ws,Ap,As); % usa essa função para calcular a ordem do filtro
%[b,a] = butter(6,fp/(fa/2)); %especifica uma ordem aleatória para fazer o filtro
[b,a] = butter(n,W... |
% -------------------------------------------------------------------------
% Part 3 - Create a I <3 NY image
% -------------------------------------------------------------------------
% Load the image "I_Love_New_York.png" into memory
iheartny_img = imread('I_Love_New_York.png');
% Display the image
figure, imshow(... |
#include "com_codename1_ui_PeerComponent.h"
const struct clazz *base_interfaces_for_com_codename1_ui_PeerComponent[] = {};
struct clazz class__com_codename1_ui_PeerComponent = {
DEBUG_GC_INIT &class__java_lang_Class, 999999, 0, 0, 0, 0, &__FINALIZER_com_codename1_ui_PeerComponent ,0 , &__GC_MARK_com_codename1_ui_Peer... |
function hedge=american_call_bin_partials(S, K, r, sigma, time, no_steps)
%--------------------------------------------------------------------------
%
% DESCRIPTION:
%
% Hedge parameters for an American call option using a binomial tree
%
%
% Reference:
%
% John Hull, "Options, Futures and other Deri... |
function op = rpms(x,m,eps)
n = length(x);
sizes = zeros(m,1);
nbigs = mod(n,m);
sizes(1:nbigs) = ceil(n/m);
sizes(nbigs+1:m) = floor(n/m);
ends = cumsum(sizes);
x = x.*eps;
x = cumsum(x);
x = [0;x(ends)];
x = diff(x);
op = sqrt(m/n)*x;
end
|
function Average_Gain_Test_MW
close all
clear all
[Gain10,K10] = get_gain('MW10'); %#ok<*NASGU>
[Gain30,K30] = get_gain('MW30');
[Gain50,K50] = get_gain('MW50');
whos Gain10
Gain = [Gain10;Gain30;Gain50];
K = [K10;K30;K50];
uK = unique(K);
muGain = NaN(length(uK),2);
for ii = 1:length(uK)
sel = K ==... |
function dataset=thresh(dataset) ;
% new_dataset=thresh(dataset) ;
% G. Raetsch 1.6.98
% Copyright (c) 1998 GMD Berlin - All rights reserved
% THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE of GMD FIRST Berlin
% The copyright notice above does not evidence any
% actual or intended publication of this wo... |
function projectedPosition = project(fx, fy, positions)
k(1,:) = [fx, 0, 0, 0];
k(2,:) = [0, fy, 0, 0];
k(3,:) = [0, 0, 1, 0];
temp = k * positions;
projectedPosition = temp(1:2,:) ./ repmat(temp(3,:), 2, 1);
end |
% Filter function for HighpassFilter
function filteredData = filter (obj, data)
% Data is assumed to be transformed.
% Sample frequency hard-coded for now
fs = 22050;
% Calculate which parts of data to set to zero and create filtering mask
delta_f = fs / length(data);
n = floor(obj.CutOff... |
function [] = Plot_xyz(position, velocity, marker)
close all
if exist('marker') == 1
if marker == 2
a = 5;
b = 6;
c = 7;
else
a = 2;
b = 3;
c = 4;
end
else
a = 2;
b = 3;
c = 4;
end
%Plot information
figure
% positions
subplot(2,1,1)
hold on
pl... |
function populacaoInteiro = converterBinarioEmInteiro(populacaoBinario)
[tamanhoPopulacao, numeroBits] = size(populacaoBinario);
populacaoInteiro = zeros(tamanhoPopulacao, 1);
for i = 1:tamanhoPopulacao
for j = 1:numeroBits
populacaoInteiro(i, 1) = populacaoInteiro(i, 1) +... |
function [xy,z] = deg2px(xyIn, z, w2px, zIsR)
% function [xy,z] = pds.deg2px(xyIn, z, w2px, zIsR)
%
% convert from degrees of visual angle to pixel coordinates
% calculates the pixel coordinates for an array of degress of visul angle
% taking the depence of x and y degrees into account (i.e. that the
% distance of the... |
function [AWV] = Hier_Codebook(N,layer,idx)
%CODEBOOK Summary of this function goes here
% Detailed explanation goes here
% 給出Hierachical codebook的weight vector
% AWV: weight vector
% N: antenna的數量
% layer: codebook的layer
% idx: 特定layer中,codeword的index
logN = log2(N);
l = logN - layer;
M = 2^f... |
x = [1 2 3 4 5];
y = [10 20 30 40 50];
plot(x,y,'r')
xlabel('°¡·Î')
ylabel('¼¼·Î')
|
function y = f2(x)
t1 = abs(x);
t2 = sum(t1);
t3 = prod(t1);
y = t2+t3; |
function [ DP_cost, DP_time, av_cost, av_time ] = DP_cut_k( cutCostsFile, cut_num, search_k)
%DP_CUT Summary of this function goes here
% Detailed explanation goes here
file_t = fopen(cutCostsFile);
cut_costs = fscanf(file_t, '%d');
fclose(file_t);
% get the initial averaging-cut
cut_le... |
% Example 110: ordinary spherical lens, sligntly misaligned
% [start, finish] = importVV('example_200_VV.txt');
%% setup
% lens front surface
s1=struct();
s1.position = [0,0,10.427852];
s1.direction=normr([0.001,0,-1]);
s1.curvature = -1/50; % 1 / radius of curvature, negative because it points away from the directi... |
function [Pp,Pn, wallnum,BF]=refraction(p,vp,m1,m2,num,AVn,B,shp)
nn=0;
Bflag=0;
Pp=p;Pn=vp;wallnum=num;BF=Bflag;
% decide wheteher point is in boundary between planes or not.
if(Boundary(p,num,AVn,B))
newp=vp;nn=nn+1;
Bflag=1;
else
% find new direct for refrection
newp=reflect(vp,AVn(num,:),m1,m2,1);
en... |
function bagdataExtraction(bagdir, bagpath, savedir)
fprintf(strcat('loading from: ',bagdir,'./',bagpath, '\n'));
try
bag = rosbag(strcat(bagdir, '/',bagpath));
catch
fprintf(strcat(bagdir,'./',bagpath,' is broken!','\n'));
return
end
bagname = bagpath(1:end-4);
%extract force torque data
%fprintf('load... |
function [dFitDLS,a0FitDLS,a1FitDLS,roF] = batchDLSFindA0A1RollOffFrequencySize (mTS, bS, eS, sS, index1, index2, istep, fs, theta, lambda, indref, eta, tcelsius,a0start, a0min, a0max, a1start, a1min, a1max, deltaFit, figType, dispMode, cleanMode)
%-----------------------------------------------------------------------... |
classdef ModelFit < AbstractModelFit
%Grid.MODELFIT
properties
end
methods
function obj = ModelFit( name, model, results, configvars, realizations, variates )
obj@AbstractModelFit( name, model, results, configvars, realizations, variates );
end
end
end
|
function varargout = grSimplifyBranches_old(nodes, edges)
%GRSIMPLIFYBRANCHES_OLD Replace branches of a graph by single edges.
%
% [NODES2 EDGES2] = grSimplifyBranches(NODES, EDGES)
% Replaces each branch (composed of a series of edges connected only by
% 2-degree nodes) by a single edge, whose extremities a... |
function [ Z ] = my_zscore( X )
% col_mean = nanmean(X);
% col_std = nanstd(X);
n = size(X, 1);
col_mean = sum(X) / n;
centered_X = bsxfun(@minus, X, col_mean);
col_std = sqrt(sum(centered_X.^2) / (n-1));
%std(X);
Z = bsxfun(@rdivide, centered_X, col_std);
end
|
function [mycolormap] = make_rbco_colormap(mapres,show)
% Creates a matrix useful for plotting pRF and ccRF correlation maps
%
% Usage:
% [mycolormap] = make_polar_colormap(show)
%
% defaults:
% show = 0; do not plot the resulting polar angle colormap
%
% Written by Andrew S Bock Oct 2014
%% Set up defaul... |
% EE368/CS232
% Homework 6
% Problem: SIFT Keypoints
% Script by David Chen, Huizhong Chen
clc; clear all;
addpath 'vlfeat-0.9.21/toolbox'
vl_setup;
imageFiles = {'pink.jpg'};
SIFTPeakThresh = [10 10];
SIFTEdgeThresh = [5 10];
for nImage = 1:length(imageFiles)
% Load original image
imgOrig = rgb... |
%@(#) contplot.m 1.2 94/01/25 12:42:13
%
function contplot
hand=get(gcf,'userdata');
ud=get(hand(2),'userdata');
if strcmp(ud(2,1:7),'image ')
ud(2,1:7)='contour';
else
ud(2,1:7)='image ';
end
set(hand(2),'userdata',ud)
ccplot
|
clc
clear
%% Read Image
I = imread('Test_resistor1.jpg');
%I = imread('Test_resistor3.jpg');
%I = imread('Test_resistor2.jpg'); % not accurate segmentation
%I = imread('Test_resistor4.jpg');
%I = imread('Test_resistor5.jpg');
%I = imread('Test_resistor6.jpg'); % not accurate segmentation
%I = imread('Test_re... |
classdef Function < casadi.SharedObject & casadi.PrintableCommon
%FUNCTION Function object A Function instance is a general multiple-input, multiple-
%
%
%output function where each input and output can be a sparse matrix. .
%
%For an introduction to this class, see the CasADi user guide. Funct... |
function [output c] = load_replace(filename)
% Loads an SVG file and exports the coordinates of each line endpoint
% contained in the order x1 y1 x2 y2
% All non line elements of the SVG file are erased through some awesome
% regular expressions. ONLY single lines (not polygons or paths)
% Load file as string
f... |
%Program to rename videos in ascending order starting from 1
a ='E:\Project\hmdb51_org\throw'; %Path where the videos are stored
A =dir( fullfile(a, '*.avi') ); %Reading videos
fileNames = { A.name };
for iFile = 1 : numel( A )
newName = fullfile(a, sprintf( '%d.avi', i... |
%% Initialization
clear ; close all; clc
mtest_begin = 75001
mtest_end = 101503;
k = 100;
ntrees = 500;
load('knnData.mat');
load('testNeighbors.mat');
load('testPreds.mat');
load('trainingPreds.mat');
weightedPreds = zeros(mtest_end-mtest_begin+1,1);
voteWeights = zeros(ntrees);
neighborPreds = zeros(k,ntrees);
y_n... |
function ring=atApplyVariation(ring,Variables,NewValues)
%ATAPPLYVARIATION Applies a series of variations to variables as described in
% Variables.
%
% Variables is a cell array of structures
%
%
% Variables struct('Indx',{[indx],...
% @(ring,varval)fun(ring,varval,...),...
% ... |
function pc=Remove_Event(IntervalArray,BinaryInputTrace,Frame)
%
% function Remove_Event(IntervalArray,BinaryInputTrace,Frame)
%
% Will remove one high event from the BinaryInputTrace and IntervalArray
% as specified by the 'Frame' input. Will be called from the plotargouts.m
% routine.
%
% IntervalArray == ['(low ... |
clc, clear, close all;
recObj = audiorecorder(96000, 24, 1); % (sampling rate, bits/sample, channels)
disp('Start speaking.'); % This just outputs text
recordblocking(recObj, 5); % This does the recording/sampling, for 5 seconds
disp('End of Recording.');
%play(recObj); % This directly plays back the recording using ... |
function BPI = myFilteredBackprojectionCentralSlice(sinogram,thetas)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% filtered back projection in the frequency domain applying central slice
% theorem-> schlegel & bille 9.2.3
% modified by: Mark Bangert
% m.bangert@dkfz.de 2017
% fig... |
function R = FindCornerMap(I)
%take an input image I, find the cornerness score of each pixel
%I is a RGB image and points is a n by 2 matrix with x coordinate in column
%1 and y coordinate in column2
[nr, nc] = size(I);
I = padarray(I, [6,6], 'symmetric'); % pad the image with symmetric padding to avoid corners at i... |
function C = myconv2(A,B,shape)
%myconv2 convolution of image-A and kernel-B
% 此处显示详细说明
Br = rot90(B,2);
C = mycorr2(A,Br,shape);
end
|
function viewRieszRotationMovies(config)
% VIEWRIESZROTATIONMOVIES view an animation of the steering of 3D Riesz
% filters
%
% viewRieszRotationMovies(config) view an animation of the steering of the
% 3D Riesz filters specified by the RieszConfig object config
saveImages = 0;
angTheta = 0:0.1:2*pi;
% frequency mask ... |
% Generate Simulated HOM data
% Generates simulated hom data
%% Inputs:
% tauvals: 1xn vector of delay values.
% invExpTrans: 1x3 vector. They first two scale and shift the time
% while the last scales the rate.
% amplitudeMatrix: 2x2 matrix that has the amplitudes of the
% interfe... |
function lagrangepoly(xi, yi, xc)
%calcula os coeficientes do polinomio de lagrange
n = length(xi);
f = zeros(1, n);
Ilog = logical(eye(n));
for i = 1:n
Pi = poly(xi(~Ilog(i,:)));
Pi = Pi ./ polyval(Pi, xi(Ilog(i,:)));
Pi = Pi .* yi(Ilog(i,:));
f = f + Pi;
endfor
disp('');
px... |
function [] = PlotNeuronOutlines(PixelList,Xdim,Ydim,clusterlist)
%PlotNeuronOutlines(PixelList,Xdim,Ydim,clusterlist)
figure;
if (~exist('clusterlist'))
clusterlist = 1:length(PixelList)
end
if(~isrow(clusterlist))
clusterlist = clusterlist';
end
colors = rand(length(clusterlist),3);
for i = ... |
function [ Gnk] = Estep( X,M,S,P,K )
%evaluates responsibilities
Gnk=zeros(size(X,1),K);
for i=1:size(X,1)
responsibilities=zeros(1,K);
for k=1:K
gauss=0;
for d=1:size(X,2)
gauss=gauss+(log(2*pi*S(k,d))+((X(i,d)-M(k,d))^2)/S(k,d));
end
gauss=log(P(k))-(gaus... |
function kinematics6()
link_length = [2 3 0 3 0 2]; % Jpint (3 and 4),(5 and 6) are coupled and jointed together.
dof = 6;
JointAngle = [ 0 30 -50 -30 -60 60] * pi / 180;
DH_table = [[0 pi/2 link_length(1) pi/2];
[link_length(2) 0 0 0];
... |
function[eta_ext] = external_PLQE(n_i,Cn,Cp,Eg,phi_rear_no_bias,tau_SRH,SRH_depletion_zero_bias,phi_r_zero_bias,V,ND,NA,Nc,Nv,Tc,E,alpha,nr,L)
fund_consts;
[n,p] = CarrierConcentration(n_i,V,Eg,ND,NA,Nc,Nv,Tc);
%B = SVR(V,E,n,p,alpha,nr,Tc); % bimolecular recombination coefficient
... |
x = load('ex5Linx.dat');
y = load('ex5Liny.dat');
% plot the data
scatter(x, y)
hold on
m = length(y); % number of data points
x = [ones(m, 1), x, x.^2, x.^3, x.^4, x.^5];
lambda = [0 1 10];
color = ['r-', 'g-', 'b-'];
for i = 1:3
l = lambda(i);
v = diag([0; ones(5, 1)]);
theta = inv(x' * x + l * v)... |
function [message,result,solverTime] = runcontest(visualizationMethod,whichBoards)
%RUNCONTEST Test an entry.
% [MESSAGE,RESULTS,TIME] = RUNCONTEST runs the file solver.m against all
% the problems defined in testsuite_sample.mat. MESSAGE returns a summary
% of the testing, RESULTS measures how well the entry sol... |
%% MyMainScript
tic;
%% ORL Dataset
% Training
N = 32*6; d = 112*92;
X = zeros(d, N); % Matrix of all the images d x N
x_bar = zeros(d, 1); % Average image d x 1
cd ../../..; % This is the location where we placed the Image Dataset
for i=1:32
D = strcat('./ORL/s',int2str(i));
S = dir(fullfile(D,'*.pgm'));
... |
function [ freq_signal,spec_gram1,noh] = Nfft( z,nos,s_frm,FFT_size)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
s_frm=s_frm+3-mod(s_frm,3);
noh=floor(nos/s_frm);
noh=noh*3;
% From which hop all the frames lie inside the file
%{
for n=1:noh
... |
function [ a ] = vecNorm( a )
%vecNorm normalizes vector "a" to a Euclidean length (i.e., magnitude) of 1
aa = dot(a,a);
if aa ~= 0 % prevent divide by zero
a = a / sqrt(aa);
end
end |
function [crossing, middlepts] = findcross(time_eye, eye, packet, thresh)
%time_eye, eye, first, thresh, rise, packet
% Dimensions [1st/2nd, Rise/Fall, Thresh, Crossings]
order = 0; %1st=1, 2nd=2
traj = 0; % Rise=1, Fall=2
pct = 0; % 20%=1 50%=2 80%=3
L = 2*length(eye);
crossing = zeros(2, 2... |
% Gy2 = imgProcessing2(Descr_te);
%
% ni = 1;
% for ni = 116 : length(InitPoints)
% initPoints = InitPoints{ni};
%
% % figure(1)
% subplot(1,2,1)
% imshow(Gy2(:,:,ni),[]); hold on
% tag = [ceil(Label_te([2,4],ni)*0.39)-1, Label_te([1,3],ni)*3-1];
% plot(tag(:,2), tag(:,1), 'c*')
% plot(ini... |
function [R,G,B] = xyz2rgb(X,Y,Z)
% Converts XYZ to RGB data.
%
% rgb = xyz2rgb(xyz)
%
% Converts between images.
%
% [r, g, b] = xyz2rgb(x, y, z)
%
% Converts between individual channels.
%
% See http://en.wikipedia.org/wiki/CIE_1931_Color_Space
%
% ----------
% Jean-Francois Lalonde
if (nargin == 1)
Z = X(:... |
% Callback for radiobutton that plots z-slice display in HASgui.
% Base workspace script.
%
% When radiobutton pushed, whatever file is specified in listbox1 is displayed
% in a 2-D z-slice at z location in editbox7.
% This version moves the patch on the box model.
% Changes:
% 1/26/11 - imagesc... |
% Wigner 3j symbol
%
% (j1 j2 j3)
% (m1 m1 m3)
%
% http://mathworld.wolfram.com/Wigner3j-Symbol.html
%
% mikael.mieskolainen@cern.ch, 2017
function wc = W3j(j1,j2,j3,m1,m2,m3)
% Check selection rules
if (W3jSR(j1,j2,j3,m1,m2,m3) == false)
return;
end
% Create coefficient structure
c1 = -j2 + m1 + j3;
c2 = -j1 - ... |
%画出弯矩图
function To_wjt(dyhz,hzlx,hzdx,hzcd,l,f,f1,f2,x0,y0,cos,sin,r_wj)
if dyhz == 0 || hzlx == 5 || hzlx ==6
X = [0,0,l,l];
Y = [0,f1/r_wj,f2/r_wj,0];
x = x0 + X * cos - Y * sin;
y = y0 + X * sin + Y * cos;
text(x(2),y(2),num2str(round(f1*1000)/1000),'fontsize',8,'color','red');
text(x... |
function [scores]=evaluateSimpVoxel2(search, candidate, comps3DVoxPorDnsized, aa,C,preComputedTemplateMat, preComputedSearch)
%load('compsHeightViewsAll');
% load('comps3DVoxPorDnsized')
% load('../../dataStructureForStatistics/bedrooms_2_with_dist_nametags');
i=candidate;
%sizesForComp = C{i}{4} - C{i}... |
CW09B.Properties.VariableNames{'Snowball'} = 'Porter';
CW09B.Properties.VariableNames{'SelSnowball'} = 'SelPorter';
groupNames = CW09B.Properties.VariableNames(:,2:end)
[p,tbl,stats] = friedman(table2array(CW09B(:,2:end)))
stats.gnames = groupNames;
[c,m,h,gnames] = multcompare(stats,'alpha',0.1,"ctype","hsd")
ytickla... |
function [nmersFound, freqDiffSorted] = motiffinder(seq, seq0, W)
% Copyright 2007 The MathWorks, Inc.
%this function is used under the from the Mathworks site https://www.mathworks.com/help/bioinfo/examples/identifying-over-represented-regulatory-motifs.html
%function was last accessed on 11/27/2017.
%=== find and c... |
function out = col(in,number)
if nargin==1
for j=1:size(in,2)
for i=1:size(in,1)
out(i,j).value = in(i,j).value(1:end-1,:);
% out(i,j).dV = in(i,j).dV(1:end-1,:);
% out(i,j).ddV = in(i,j).ddV(1:end-1,:);
% out(i,j).nzx = in(i,j).nzx(1:end-1,:);
% out(i,j).nzy = in(i... |
function delta = delta_fun(k, noise_est)
log_gamma = gammaln((k+1)/2) - gammaln(k/2);
delta = noise_est * sqrt(2) * exp(log_gamma);
end |
% Na aplicação fariam:
transmissor("bomba-app", ["str1","str2","str3"])
output1 = recetor("app-bomba", 2);
transmissor("bomba-app", ["str4","str5","str6"])
output2 = recetor("app-bomba", 2); |
function varargout = ui(varargin)
% UI MATLAB code for ui.fig
% UI, by itself, creates a new UI or raises the existing
% singleton*.
%
% H = UI returns the handle to a new UI or the handle to
% the existing singleton*.
%
% UI('CALLBACK',hObject,eventData,handles,...) calls the local
% func... |
% clc; clear;
% D = 2;
% b1 = rand(D, 1);
% p = rand(D, 1);
% a1 = randn(1, 1) / pi;
% d1 = rand(1, 1);
function [f, df] = jacobian_ik_point_analytical(p, b1, d1, a1)
D = length(p);
arguments = 'c1, a1';
variables = {'c1', 'a1'};
%d1 = d1 * [1; 0];
b1_ = @(b1, a1) b1;
R = @(b1, a1)[cos(a1), -sin(a1); sin(a1),... |
%% Plot Some invchi2 Distributions
%#testPMTK
figure;
%nu = [1 1 1 5 5 5 ];
nu = [1 1 1 2 2 2];
sigma2 = [0.5 1 2 0.5 1 2];
%sigma2 = sigma2 .* nu;
N = length(nu);
[styles, colors, symbols] = plotColors;
%colors = hsvrand(N);
xrange =[0.01 2];
for i=1:N
h = plot(InvWishartDist(nu(i), sigma2(i)), 'plo... |
function [val] = wavefront_propogate(val)
[i j] = find(val == 0)
val = fan(i,j,val, 0);
end
|
function mHom = tmat2hom(m)
%TMAT2HOM converts the input transformation matrix to homogeneous form.
s = size(m);
if ~all(s == s(1))
error('The input matrix must be a square matrix.');
end
mHom = eye(s(1) + 1);
mHom(1:s(1),1:s(2)) = m; |
function [] = plot_meanByCond_deve( result )
global p;
subplot(2,2,1)
plotOneMeasure(result.stepsUsed, 'Steps used')
subplot(2,2,2)
plotOneMeasure(result.completeRate, 'Complete rate')
subplot(2,2,3)
plotOneMeasure(result.propSkips, 'Proprtion skips')
subplot(2,2,4)
plotOneMeasure(result.propItemsTouched, 'Proprtion... |
r = randi([1,1000],1,4);
mu = zeros(4,157);
for i=1:4
mu(i,:) = X(r(i),:);
end
c = zeros(m,1);
s = zeros(30,1);
ratios = zeros(30,1);
%repeat until convergence
for z=1:30
z
for i=1:m
temp = zeros(4,1);
for j=1:4
temp(j) = norm(X(i,:) - mu(j,:))^2;
end
[dummy, c(i)] = min(temp);
%temp
%c(i)
%pause;
end
sum... |
function [gpu_comp,g]=get_gpu_comp_stat()
g=[];
gpu_comp=0;
fig=findobj(0,'Type','figure','-and','Name','ESP3');
if ~isempty(fig)
curr_disp=get_esp3_prop('curr_disp');
if ~isempty(curr_disp)
if curr_disp.GPU_computation == 0
return;
end
end
end
try
if ~isdeployed()... |
function [ X_hat_d ] = Outer_Loop5( n, I_d, x_hat )
%UNTITLED18 この関数の概要をここに記述
% 詳細説明をここに記述
X_hat_d = zeros(n, 1);
for k = 1:n
if I_d(k) == 1
X_hat_d(k) = complex(median(real(x_hat(k,:))), median(imag(x_hat(k,:))));
end
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.