text stringlengths 8 6.12M |
|---|
clc
clear
x = (1:100) + 50*cos((1:100)*2*pi/40);
X = dct(x);
[XX,ind] = sort(abs(X),'descend');
i = 1;
while norm(X(ind(1:i)))/norm(X) < 0.99
i = i + 1;
end
needed = i
% Reconstruct the signal and compare it to the original signal.
X(ind(needed+1:end)) = 0;
xx = idct(X);
plot([x;xx]')
legend('Original',['Reconst... |
function [theta,Jstar, fcount, nIter, exitflag] = uq_SVR_hyperparameters_optimizer( current_model )
%% READ options from the current module
% Obtain the current output
current_output = current_model.Internal.Runtime.current_output ;
optim_options = uq_SVR_initialize_optimizer(current_model) ;
% Retrieve the handle of... |
function PTcoherenceN_prs2(obj, evt)
hndl = get(gcf, 'Userdata');
set(hndl.uicontrol.control.waveN, 'Enable', 'off');
set(hndl.uicontrol.control.FFTN, 'Enable', 'off');
set(hndl.uicontrol.control.coherenceN, 'Enable', 'off');
set(hndl.uicontrol.control.phaseN, 'Enable', 'off');
fin = dir(fullfile(hndl... |
% 对 UCF101的数据库进行前中后的dynamic image
clc
clear
% 读取第一个大序列 S001…………
%%
% 如果没有,需要添加Libsvm工具箱
addpath('E:\chenjun\dynamic\liblinear-1.96\matlab');
path_all = 'E:\chenjun\ucf101\UCF_101';
file_all = dir(path_all);
for i = 81:length(file_all)
num = 1;
path_file_i = [path_all,'\',file_all(i).name];
file_all_i = di... |
height = 752;
width = 480;
matrix_height = 0;
gamma = 0;
fi = 0;
[columns, rows] = meshgrid(1:width, 1:height);
centerX = width / 2;
centerY = height / 2;
radX = 100;
radY = 100;
pixels = (rows - centerY).^2 ./ radY^2 ...
+ (columns - centerX).^2 ./ radX^2 <= 1;
image(pixels);
colormap([0 0 0; 1 1 1]);
image = z... |
function areas = polygonIntersectionArea(P1, P2)
% areas = polygonIntersectionArea(P1, P2)
% Compute the areas of the intersection between two polygons.
% P1 and P2 are structures containing information about the two polygons
% Structure: P.x and P.y
% x: [x1 x2 ... xn]
% y: [y1 y2 ... yn]
% where (x... |
#89296
#ALL
#PECIAL
X=[3:15];
Special_Tempo=[0, 0 ,0 ,0 ,0 ,0 ,0.001 ,0.006 ,0.063 ,0.667 ,9.415 ,151.341 ,1899.003];
Special_Dist_Max=[1061,1444,1793,2017,2322,2849,3516,3668,4130,4502,4831,5835,6213];
Special_Dist_Min=[821,957,944,956,968,973,1168,1176,1291,1330,1333,1635,1676];
figure(1);
subplot(1,2,1);
scatter(X,... |
% 划分窗口:第一行有两个小窗口,第二行有一个大窗口。
x = -5 : 0.1 : 5;
y1 = sin(x);
y2 = sin(2 .* x);
y3 = sin(3 .* x);
subplot(2,2,1);
plot(x, y1);
subplot(2,2,2);
plot(x, y2);
subplot(2,2,[3, 4]); % 这里用中括号把两个窗口括起来,即合并。
plot(x, y3); |
function Trig=MakeTrig(Pts,Facets,Edges)
Trig.Coords = Pts;
Trig.Facets = Facets;
Trig.Edges = Edges;
Trig.FixIds = [];
Trig.NVerts = size(Trig.Coords,1);
Trig.NFacets= size(Trig.Facets,1); |
%% test to see if the real pair has singnificanct coherence than the fake ones using this paper
%{
Information flow between interacting human brains:Identification, validation, and relationship to social expertise
For the discovery sample, the reference distribution of nonpairs was created by 1,000 repetitions of the ... |
function [actual_dists_mat, id_dists_mat] = predict_with_L_R_pca(cfg_in, Q)
% Perform PCA, and obtain procrustes transformation in PCA space
% and predict target (trajectory of Q matrix).
% The way that this function obtains procrustes is concatenating left(L) and right(R) into [L, R].
% If shuffled is ... |
function [ cost, grad, pred_prob] = supervised_dnn_cost( theta, ei, data, labels, pred_only)
% Does all the work of cost / gradient computation
%% Determine activation function type.
if strcmp(ei.activation_fun, 'logistic')
f = @sigmoid_activation;
f_derivative = @(A) (A.*(1-A));
elseif strcmp(ei.... |
classdef GlmDirectorComponent
%% GLMDIRECTORCOMPONENT
% $Revision$
% was created $Date$
% by $Author$,
% last modified $LastChangedDate$
% and checked into repository $URL$,
% developed on Matlab 8.1.0.604 (R2013a)
% $Id$
methods (Abstract)
ds = theDatasetOnePredictor(this)
... |
function [I,peak]= ContAdj_Intensity(rawImg, inf, ref)
end
% function [I,peak]= ContAdj_Intensity(rawImg, inf, ref)
% x1 = double(rawImg)/3000;
% ref1 = double(ref)/3000;
%
%
% [count,~] = imhist(ref1,1000);
% [~,b1] = sort(count,'descend');
% b1(b1<50) = [];
%
% [count,... |
% A simple model for RGC
function RGCModelwithSubunits
global RefreshRate; %Stimulus refresh rate (Stim frames per second)
global pStim;
global pRF;
RefreshRate = 30;
%set up 'world' parameters
pWorld.dur = 10^5; % total stimulus duration (seconds)
pWorld.rf = RefreshRate; % Monitor refresh ... |
clear
a1 = uint8(120)+9 %注意有u和沒u的差別,有u:無號整數,沒u;有號整數
whos a1
% a2 = int8(120)+int16(250) %兩個資料精度不一樣無法運算
a3 = int16(120)+int16(250)
whos a2
a4 = 10^10
whos a3
class(a3) %判斷變數的資料型態
ch1 = 'A'
class(ch1)%判斷變數的資料型態
v1=double(ch1)
ch2 = 'ABCD'
v2=double(ch2)
ch3='abc'
v3=double(ch3)
class(v3)%判斷變數的資料型態
v4=char(65)
class(v4)%判... |
function new_array = convert_2d(old_array)
% convert 3D array into 2D...
% Input: old_array : 3d array of shape 1xMxN
% Output: new_array : 2d array of shape MxN
new_array = reshape(old_array, [size(old_array, 2), size(old_array, 3)]);
end |
% Compute the total degree, in-degree and out-degree of a graph based on
function [deg,indeg,outdeg]=degrees(graph)
indeg = sum(graph);
outdeg = sum(graph');
if isdirected(graph)
deg = indeg + outdeg; % total degree
else % undirected graph: indeg=outdeg
deg = indeg + diag(graph)'; % add self-loo... |
function [position] = PredictPosition(kalmanTracker, measurement)
[~, N] = size(kalmanTracker.xs);
maxLen = length(measurement);
if maxLen > N
for i = N:maxLen
% https://math.stackexchange.com/questions/982982/kalman-filter-with-missing-measurement-inputs
kalmanTracker.pred... |
function [Name,timestamp]=img2mat_IR(scale,PathName)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Function looks in a directory. For every step of images one output file
% is generated. The timestamps of the images are in the output as well.
% Inputs:
% scale - Input from 0 to 1.... |
%result = integ1(6);
%fprintf('%f\n', result);
y = zeros(1,100);
for i = 1:1:100
y(i) = integ1(i);
end
subplot(2,1,1)
plot(y)
ylim([0, 3.5])
title('I(N) vs N')
xlabel('N')
ylabel('I(N)')
grid on
%result = integ2(100);
%fprintf('%f\n', result);
z = zeros(1,100);
for i = 1:1:100
z(i) = integ2(i);
end
subpl... |
function [ pro ] = projection( a )
siz=size(a);
n1=siz(1,1);
n2=siz(1,2);
pro=[];
for j=1:1:n1
sum=0;
for k=1:1:n2
sum=sum+a(j,k);
end
pro=[pro sum];
end
for j=1:1:n2
sum=0;
for k=1:1:n1
sum=sum+a(k,j);
end
pro=[pro sum];
end
end |
function tcond=sw_tcond(s,t,p)
% function tcond=sw_tcond(s,t,p) gives the thermal conductivity
%
% based on caldwell dsr 21:131-137 (1974) eqn. 6,7,8
%
% s salinity
% t temperature (deg. c)
% p pressure (dbars)
%
% tcond thermal conductivity (j m-1 k-1 s-1)
%
% tcond(40.,40.,1000.)=0.662378305796... |
function [p0c,p1c,dp0c,dp1c] = autoGen_kinematicsContact(x,y,phi0,phi1,th0,th1,dx,dy,dphi0,dphi1,dth0,dth1,qc0,qc1,rc0,rc1,l)
%AUTOGEN_KINEMATICSCONTACT
% [P0C,P1C,DP0C,DP1C] = AUTOGEN_KINEMATICSCONTACT(X,Y,PHI0,PHI1,TH0,TH1,DX,DY,DPHI0,DPHI1,DTH0,DTH1,QC0,QC1,RC0,RC1,L)
% This function was generated by the Symb... |
% Tao giai dieu cho audio dau vao
fs = 44100; % tan so phat
t = 0 : 1/fs : 0.3; % thoi gian phat
fdoo = 528; % tan so cua cac not nhac
fsi = 495;
fla = 440;
fsol = 396;
ffa = 352;
fmi = 330;
fre = 293;
fdo = 264;
A0 = .7;A1 = .6; A2 = .5; A3 = .4; A4 = .3; A5 = .2; A6 = .1; % bien do
w = 0; % pha
... |
LL = load('../Result_Data/GroupFairness/accuracy_matrix_group');
Tau = load('../Result_Data/GroupFairness/tau_matrix_group');
LL = LL.dummykey';
Tau = Tau.dummykey';
Alpha = [0,0.25,0.4,0.5,0.6,0.7,0.8];
f1=figure(1);
set(0,'DefaultAxesFontSize', 22)
alphaIndex = 0;
for alpha=Alpha
alphaIndex = alphaIndex+1;
... |
function [data_mean,data_diff,md,sd] = bland_altman_x_gt(data1,data2)
% Function to generate Bland Altman plots. Barry Greene, September 2008
% Bland, J.M., Altman, D.G. 'Statistical methods for assessing agreement ...
% between two methods of clinical measurement'(1986) Lancet, 1 (8476), pp. 307-310.
%
% Inputs: data1... |
%% Main section with filters
clc
clear all
close all
load Cropcor
load boundary_components
file_names_clip = dir('C:\Users\Abhinav Sharma\Documents\Carnegie Mellon Research\CMU Lab Research\2016\Split Belt Analysis\Computer Vision\Paw Tracking\August 3rd 2016\Movie Frames from ClippedMOV005');%for i=1:1:size(file_names... |
for i = 1:size(d,3);imagesc(d(:,:,i));drawnow;pause(0.01);end
d= bsxfun(@minus,single(data),single(mean(data,3)));
d= bsxfun(@rdivide,single(d),single(mean(data,3)));
size(d)
for i = 1:size(d,3);imagesc(d(:,:,i));drawnow;end
for i = 1:size(d,3);imagesc(data(:,:,i));drawnow;pause(0.1);end
%%
data = permute(data,[3 1 ... |
function [A,B,Q,Z] = qzswitch(i,A,B,Q,Z)
%function [A,B,Q,Z] = qzswitch(i,A,B,Q,Z)
% Written by Chris Sims
% Takes U.T. matrices A, B, orthonormal matrices Q,Z, interchanges
% diagonal elements i and i+1 of both A and B, while maintaining
% Q'AZ' and Q'BZ' unchanged. Does nothing if... |
figure(1);
subplot(2,1,1);
plot(a_3)
title('white noise');
subplot(2,1,2);
plot(b_3)
title('white noise ');
figure(2);
subplot(2,1,1);
plot(c_3)
title('Random');
subplot(2,1,2);
plot(d_3)
title('random');
|
function GUI_NA
global handles;
handles.currnetname=mfilename('fullpath');
handles.currPath = fileparts(mfilename('fullpath'));% get current path
%导入数据
try
load([handles.currnetname '.mat'])
catch
handles.IP='192.168.1.106';
handles.Freq_star='6';
handles.Freq_stop='7';
handles.Freq_SwpPoint=200;
... |
classdef OptionInfo<handle
%OPTIONINFO
% --------------------------
% 程刚,201511
% 程刚,20160126,有了一个新的更简洁的类 OptInfo,这个类暂时不怎么用了
% 合约固定信息
properties(SetAccess = 'public', GetAccess = 'public', Hidden = false)
contractCode; % 合约编码:10000427
optCode; % 合约交易代码:'510050C1407M150... |
data = csvread('final3Ddata.csv');
x = data(:,1);
y = data(:,2);
z = data(:,3);
z = z - max(z);
p = patternCustom(z,y,x);
while true
pause(0.01)
if ~isvalid(p)
exit
end
end
|
function xx = sig_reconstruct(tx, time, p2f, p2a)
% xx(n) = sig_reconstruct(tx(n), time(t), p2f(t), p2a(t))
%
% Reconstruct signal for time values xt from the result
% of select_2peaks_t(), frequencies and amplitudes of
% two peaks, p2f(time) and p2a(time)
%
% -- slazav, feb 2012
np=length(time); % number of input p... |
%% Stelling 10
%
% De operatie [1 2 3]/[1 2 3] geeft als resultaat [1 1 1]
%
Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
|
dataArray = importdata('curve_data.csv');
data1 = dataArray.data;
plot(data1(:,1),data1(:,2)*10^3)
title('IV Curves for Perovskite Sample (Composition X)')
xlabel('Voltage (V)')
ylabel('Current (mA)')
hold on
index = 4;
for i = 4:(size(data1,2)/3-3-3*3)
V = (data1(:,index)+data1(:,index+3))/2;
I ... |
function [v_store, betav_store] = qr_Householder_basic(A)
% Size of A
[m,n] = size(A);
for j = 1 : n - 1
[v,betav] = house(A(j:m,j));
H = (eye(m-j+1) - betav * (v * v') ); % I'd prefer not to use H{j}!
A(j:m,j:n) = H * A(j:m,j:n);
if j < m
A(j+1:m,j) = v(2:m - j + 1);
end
% Store... |
function plot( obj )
keys = fetch(obj);
for ikey = 1:length(keys)
key = keys(ikey);
[fhMap, reversal, frev] = fetch1(StatArea(key),'fhMap','reversal','frev');
imagesc(normalize(fhMap,2))
hold on
plot(reversal,1:size(fhMap,1),'.k')
plot(frev,1:size(fhMap,1),'.y')
title([key.exp_date ' ' num2... |
%script to run a simulation both in normal mode and in real time
% REQUIRES simulink_system TO RUN THE SIMULATION
if exist('we_are_in_a_simulation','var') == 1
else
disp("can't find we_are_in_a_simulation... assuming we_are_in_a_simulation = 1")
we_are_in_a_simulation = 1;
end
if exist('stop_time','var') == ... |
for floorNum = 1 : 8
end |
function Depl = deployment_parameter_loge( iDeployment, Param )
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
Depl.segNFft = 2^nextpow2(Param.FLUXRANGE); %test copied from main5
Depl.location = 'Loge'; %place of the camapign
Depl.date = '29-Apr-2021'; %date of the campaign
D... |
%% 题目1:一个信号由15Hz、振幅为0.5的正弦信号和40Hz、振幅为2的正弦信号组成。
%% 数据采样频率Fs=100Hz(对应于采样间隔为0.01s)。
%% 试分别绘制N=128(采了128个点)的FFT"振幅频率图"和N=1024的振幅频率图。
clc; clear;
N = input('输入采样总点数(N=2^n):'); % 总采样点数
fs = 100; % 采样频率
n = 0:N-1; % 样本点的序号(从0开始)
t = n/fs; % 每个样本点对应的采样的时刻
x = 0.5*sin(2*pi*15*t) + 2*sin(2*pi*40*t); % 原始信号(仍是离散... |
function parsave_SVD_STRESS(NAME_WS_STORE,SNAP_STRESSES,SingleV_STRESS,PHI_STRESS,V_STRESS)
% parsave_SVD_U(NAME_WS_STORE,SNAP_DISP{igroup},SingleV_DISP,PHI_DISP,TRAJECTORIES,list_snapshots_show,NAME_SCRIPT);
% parsave_SVD_STRESS(NAME_WS_STORE,SNAP_STRESSES{igroup},SingleV_STRESS,PHI_STRESS,V_STRESS)
save(NAME_WS_STO... |
% Salvar Como: 'gradientDescent.m"
function [w, J_it] = gradientDescent (X, y, w, alpha, iters)
m = length(y);
J_it = zeros (iters, 1);
for i=1:iters
hX = sigmoide (X * w);
hXmenosY = hX - y;
w = w - alpha / m.* (hXmenosY' * X)';
J_it(i)=funcaoCusto(w, X, y);
end
end
|
function ardSetColors(oncolor, offcolor)
global ardVar;
panelConstants;
disp(['Set colors: ',num2str(oncolor),',',num2str(offcolor)]);
ardI2Cecho(SETDATA, ONVAL, oncolor,0,0);
ardI2Cecho(SETDATA, OFFVAL, offcolor,0,0);
|
clear
Generate_Output;
%%
Color=get(gca,'ColorOrder');
X=datenum(2020,2:2:36,1); XT=X+1-datenum(2020,1,1); XTL=datestr(X,'mmm');
figure(2); clf; set(gcf,'position',[1 830 1500 515]);
for LOOP=1:5
load(['Warwick_Output_Loop' num2str(LOOP) '_06_11_21.mat'])
subplot(1,3,1)
England_Data=squeeze(su... |
classdef ModeSplitStandingWaveInAClosedChannel < SWEMSBarotropic3d
%STANDINGWAVEINACLOSECHANNEL 此处显示有关此类的摘要
% 此处显示详细说明
properties ( Constant )
hmin = 0.001;
%> channel length
ChLength = 100;
%> channel width
ChWidth = 20;
%> channel depth
H0 = 7... |
% Rescale images and track markers (Mod. R.Hopf, April 2013)
function [validx,validy]=track_images_rescaled_adjacent(CORRSIZE,filenamelist,grid_x,grid_y,reduction_factor,outputPath,imagePath)
% Load necessary files
if exist('grid_x','var')==0
load([outputPath 'grid_x.dat']) % file with x pos... |
function photoOff = checkPhotoOff(ai)
offThresh = 150;
data = [];
photoOff = 0;
tic
while isempty(data)
data = peekdata(ai,1);
timelapse = toc;
if(timelapse > 0.002)
data(end,4) = 0;
break;
end
end
flushdata(ai);
if data(end,4)< offThresh
photoOff = 1;
end
|
load Cactus_96frames
outfile='Cactus1024.yuv';
fid=fopen(outfile,'wb');
a=uint8(a);
b=uint8(zeros(512,512));
for ia=33:64
fwrite(fid, a(:,:,ia), 'uint8');
fwrite(fid, b, 'uint8');
fwrite(fid, b, 'uint8');
end
fclose(fid);
|
% Loads the data from the given experiments, and runs a logarithmic
% decrement on each experiement given to recover all key data.
% Plots the results for manual sanity checks after re-zeroing the
% experiment so that t=0 of the plot is where the highest peak is in the
% X dataset (doesn't actually change the data)... |
function [ numMols ] = mergingfunc(params)
%mergingfunc function version of Merging to be couple with MergingApp
% passed cell matrix ->
% [filePath, conFrameFilter, uncFactor, wantsVis, wantsDebug, stopFrame,
% wantsRec maxDepth, wantsVerbose, stopSpecs]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Mergin... |
function simNet_plot(matSim,lsOrganName,numPixel,dbThreRatio)
if dbThreRatio > 1.0,dbThreRatio=1.0;end
if dbThreRatio < 0.0,dbThreRatio=0.0;end
cvSizeNorm = 128 * numPixel/max(numPixel);
matColor = jet(128);
% Normalize the similarity score
matSim = matSim/max(matSim(:));
figure();
matSim(matSim < dbThreR... |
function s = dotSim( a, b )
% Author: Hani Zakaria Girgis, PhD
% The Bioinformatics Toolsmith Laboratory
% The University of Tulsa
%
%SIM Calculates the similarity of two vectors using the inner product.
% Avoid dividing by zero
if(norm(a) == 0)
aNorm = a;
else
aNorm = a / norm(a);
end
% Avo... |
% Es 27
% Given x(n) defined as the sum of two sinusoidal signals,
% sampled at Fs = 500 Hz with duration 3 seconds, one with frequency 50 Hz
% and the other one with frequency 100Hz:
% Downsample x(n) with downsampling factor M = 4
% Decimate x(n) with decimation factor M = 4, using a FIR filter with order 64.
% P... |
%% Profile test
%% Set stimulus block
exp_duration = 180;
stim_duration = 60;
blank_duration = 30;
stim_status = 0;
current_Reference = whiteReference;
current_Thresh = whiteThresh;
ct=1;
tempCount=1;
previous_tStamp=0;
tElapsed=0;
stimProperties.gaborAngles(:)=0;
display=boolean(1);
previous_arm=zeros(numROIs,1);
... |
%Titus John
%Leventhal Lab, University of Michigan
%2/1/2016
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
clc
pawMarkingData_directory = 'C:\Users\Administrator\Documents\Paw_Point_Marking_Data';
computeCamParams = false;
camParamFile = 'C:\Users\Administrator\Desk... |
function [o3abs]=ozonecoeff2(fname,ozonepos,dcfname,outfname,O3xsec,fitgauss);
%function [o3abs]=ozonecoeff2(fname,ozonepos,dcfname,outfname,O3xsec,fitgauss);
% 4 2 98 julian
% ozonepos is total steps from uvzero.
% dcfname is dcfile name for brstps.
% fname is data from alldsp
% dcfname is file ontained from sav... |
function output = myShape(A)
output = reshape(A, size(A,1)*size(A,2),3)';
end |
function [da,db,dc] = G_sum(x,y,a,b,c)
% Set parameters
S = size(x);
N = S(2);
S1= size(b);
N2 = S1(1);
suma = 0;
sumb = zeros(N2,1);
sumc = zeros(N2,1);
for i=1:N
exp_sum = 0;
for j = 1:N2
exp_sum = exp_sum + b(j)*((x(j,i)-c(j))^2);
end
y_hat = a*exp(-exp_sum);
suma = suma + (y(i)- y... |
%Class that is a template for voltage sources in the circuit
classdef VSource<handle
properties
voltage %Voltage on the voltage source
current %Calculated current on voltage source
power %Calculated power on voltage source
node1 %Node (id) connected to positive terminal
... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Visualization: Category-specific bars
%
% Red bars for gratings, blue bars for patterns. In data, and in
% simulation.
%
% NOT COMPLETE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Load a dataset
datasetNum... |
function [tfound,vidobj] = proc_landmarks(fname, lmarks)
%%
vidobj = mmreader(fname);
h = vidobj.Height;
w = vidobj.Width;
frameskip = 5;
frames = vidobj.NumberOfFrames / frameskip;
lmark_xblk = -10:10;
lmark_yblk = -20:20;
lmark_hue = 0.01459;
hue_th = 0.02;
lmark_sat = 1;
sat_th = 0.1;
lmark_val = 0.7;
val_th = 0.... |
clear all
close all
clc
% load mandrill
% colormap(map)
% [x,y,z] = cylinder;
% Xhalf = [ones(480,375)*max(max(X))/2, X, ...
% ones(480,125)*max(max(X))/2];
% surface(x,y,z, 'FaceColor','texturemap',...
% 'EdgeColor','none','Cdata',flipud(Xhalf))
% view(3)
[XD,YD,ZD] = peaks(25);
load clown
C = flipud(X);
figure
surfac... |
function sum = delta(nUsers, tags, nMovies, userRating, userType, movieType)
sum = zeros(nUsers,tags);
for j = 1:nUsers
for i = 1:nMovies
if userRating(i,j)!=-1
sum(j, :) += ((userType(j, :)*movieType(i, :)') - userRating(i,j))*movieType(i, :);
end
end
end
end |
function [architectures] = EvaluateGNC(filename)
%EvaluateGNC.m
% This function reads a CSV file generated by OPN with a set of feasible
% architectures and computes cost and performance for each architecture.
% Open CSV file
fid = fopen(filename,'r+');
if fid == -1
disp(['EvaluateGNC: Error when openi... |
function x = fn_str2double(x)
% function x = fn_str2double(x)
%---
% scan character array x to read a double... only if is really a character
% array!!
%
% See also fn_num2str
% Thomas Deneux
% Copyright 2007-2012
if ischar(x)
x = str2double(x);
end |
function CL = gumbelCL(theta,data)
% function CL = gumbelCL(theta,data)
%
% The negative copula log-likelihood of a member of Gumbel's family
% Taken from Joe (1997), p142.
%
% Thursday, 27 July, 2000
%
% Andrew Patton
%
% INPUTS: theta ;
% data = [U V];
% Written for the following papers:
%
% Patt... |
function coords = getLinSpacedPointsOnRectGrid(rect,xdist,ydist)
x = rect(1);
y = rect(2);
n = x*y;
coords = NaN(2,n);
counter = 1;
for i = 0 : x-1
for j = 0 : y-1
coords(1, counter) = i;
coords(2, counter) = j;
counter = counter+1;
end
end
coords = coords + repmat([... |
function [I_out] = planck(T,wl)
%
% I = planck(T,wl)
%
% wl = [nm]
% I = [W/sr/m^2/nm]
wl = wl*1e-9; % nm -> m
k = 1.38064853e-23;
h = 6.626070041e-34;
c = 299792458;
for n=1:length(wl)
a = 2*h*c^2/wl(n)^5;
b = h*c / (wl(n)*k*T);
I_out(n) = a * (1/(exp(b)-1)); % W/sr/m^2/m
end
I_out = I_out*1e-9; % to ... |
x1 = 2 * rand(1, 10000) - 1; % secuencia 1
x2 = 2 * rand(1, 10000) - 1; % secuencia 2
x3 = 2 * rand(1, 10000) - 1; % secuencia 3
x4 = 2 * rand(1, 10000) - 1; % secuencia 4
x5 = 2 * rand(1, 10000) - 1; % secuencia 5
sx = x1 + x2 + x3 + x4 + x5; % suma de secuencias
subplot 223; hist(x1, 100); title('Histogra... |
clc;close all;clear all;
system('unset PYTHONHOME');
system('source activate tensorflow');
system('conda list');
% system('python /home/zouyunzhe/HumanPose/pose-tensorflow/demo/demo_multiperson.py TF_CUDNN_USE_AUTOTUNE=0'); |
%This script generates an example of a binaural transfer function from ITD
%and IAC from the nerve
clear
load('/media/ravinderjit/Data_Drive/Data/AuditoryNerve/DynBin/MseqAnalyzed_10.12.18.mat')
addpath('../../Neuron Analysis Functions')
data_IAC = data_NOSCOR{4};
fs = 48828.125;
H_imp = data_IAC.MSO.H_imp{2};
H_NF... |
function depth = sentence(dir1, speed1, dir2, speed2, servo, s)
% Motor 1
if (speed1 > 45)
fprintf(1, 'Value is too high, sending 45');
speed1 = 45;
end
if (speed1 < 0)
fprintf(1, 'Value is too low, sending 0');
speed1 = 0;
end
% Format of string1 must be '$045!'
if (dir1 == 0) a = '$0';
elseif (dir1 ... |
""" Grafische Darstellung der relativen Häufigkeiten als Histogramm """
fig = plt.figure(2, figsize=(12, 4))
ax1, ax2 = fig.subplots(1,2)
ax1.hist(X, Klassengrenzen, histtype='bar' , color='b', weights=np.ones(N)/N, rwidth=1)
ax1.grid(True, which='both', axis='both', linestyle='--')
ax1.set_xlabel('Klebermenge m / mg')... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-% ------------------------------------------------------------------- %-%
%-% Approximates the solution to the CH equation, which is given by %-%
%-% u_t - u_{xxt} + 3uu_x = 2u_xu_{xx}+uu_{xxx}. The spatial domain is %-%
%-% [0,50] and p... |
function r = load_aircraft_instruments(r)
[~,txt]= xlsread('C:\Documents and Settings\Dani\My Documents\PhD\research\projects\Rule-based System Architecting\EOLanguage\CaseStudies.xlsx','Instruments');
fid = - 1;
filename = [];
filepath = [];
for i = 2:125
line = txt(i,:);
instr_name = line{2};
if (~isempty... |
function calculate_returns(file_path_resolver, file_name_resolver, params)
for iterator=1:length(params)
param_array = params(iterator);
validate_property_exists(param_array, 'execution')
file_name = file_name_resolver(param_array);
file_path = file_path_resolver(param_array);
data = load... |
%thickness_calc
p16 = '1p16_thick.s2p';
frequency = dlmread(p16,' ',9,0,[9 0 209 0]);
p16_m11 = dlmread(p16,' ',9,1,[9 1 209 1]);
p38 = '1p23_thick.s2p';
p23_m11 = dlmread(p38,' ',9,1,[9 1 209 1]);
p44_2 = '1p30_thick.s2p';
p30_m11 = dlmread(p44_2,' ',9,1,[9 1 209 1]);
p52 = '1p37_thick.s2p';
p37_m11 = dlmread(p52,' ',... |
function [testdata]= gentestdata(fmat, teams)
% fmat is the feature matrix having f features per team- the first column is teamID for home team,
% next f columns are features for home team, next column is teamID for away team,
% next f are features for away team, last column is the y vector
[n_teams, ~]= size(teams)... |
function x = idddtree(dt)
%IDDDTREE Inverse Real and Complex Double and Double-Density
% Dual-Tree 1-D DWT
% X = IDDDTREE(DT) returns the reconstructed vector X
% using the decomposition tree DT.
%
% DT is a structure which contains five fields:
% type: type of tree.
% level: level of dec... |
% plot_tetrads.m
% Usage: Loops over given sim directories, calculates the tetrad characterstics
% and saves them in the folder
function plot_tetrads();
addpath ~/bbtools/multipart-stats/tetrads
addpath ~/bbtools/general
[files, ts, te] = read_files(pwd);
ROOT_DIR = (pwd);
for ff = 1:length(files)
%useData = (~i... |
%% calculates the number of camera angles, queries speech on/off, or left/right half of court
% to do this, I created fake subject, 1009-11, and I watched the videos,
% clicking the mouse each time there was a camera change / any speech / lr
% change in the court position. This script just reads in that file as if I
% ... |
function [J, grad] = costFunctionReg(theta, X, y, lambda)
%COSTFUNCTIONREG Compute cost and gradient for logistic regression with regularization
% J = COSTFUNCTIONREG(theta, X, y, lambda) computes the cost of using
% theta as the parameter for regularized logistic regression and the
% gradient of the cost w.r.t. ... |
function pixMask
set(gcf,'WindowButtonDownFcn',@wbdcb)
hold on
title('Outline valid area with mouse')
%waitfor(gcf);
end
function wbdcb(src,evnt)
if strcmp(get(src,'SelectionType'),'normal')
set(src,'pointer','circle')
cp = get(gca,'CurrentPoint');
xinit = cp(1,1);yinit = cp(1,2);
set(src,'WindowButto... |
function ini_score = func_setIni_score(ini_net, ini_func, data_all)
% ini_net: ntop x (num_gene*(num_gene+2^Kmax))
% global ntimes;
% global num_gene;
global num_celltype;
data = data_all(num_celltype+1:end,:);
typeNum = data_all(1:num_celltype,1);
ini_score = [];
% N = size(data,2);
... |
%{
When recordings are automated, a section of more than one recording goes into
the same file.
This function is used to separate these recordings into individual files
so they can be analyzed the same way as the previous recordings.
%}
function process_batch_abf2mat(filename_h)
f_abf = dir([filename_h '*.abf']);... |
function [ h ] = softmax( a )
%softmax calculates the softmax
num = exp(a);
denom = sum(num,2);
denom=repmat(denom,1,size(a,2));
h = num./denom;
% assert(abs(sum(h) - 1) < 1e-3);
end
|
function props = getProperties(obj)
% GETPROPERTIES Returns the properties for the blob
% Copyright 2018 The MathWorks, Inc.
%logObj = Logger.getLogger();
props = azure.storage.blob.BlobProperties();
props.Handle = obj.Handle.getProperties();
end %function
|
function [A,B,C,D,Na_new,Nb_new,Nc_new,Nd_new] = boxes_check_reaction_trimolecular(A,B,C,D,Pf,~,~,rho2,Da,Db,Dc,D2,D3,deltaN,Nd,box_count_x,box_count_y,box_count_z,spacing)
Itemp=1;
ETA2=[];
ETA3=[];
Atemp=zeros(size(A,1),7);
Btemp=zeros(size(B,1),7);
Ctemp=zeros(size(C,1),7);
Atemp(:,1:3)=A;
Btemp(:,... |
function[] = stab_U1(s, job, cc)
% Computes the absolute stability region of s-stage RKU, a variant of RKC
% using Chebyshev polynomials of the second kind. This is the first order
% accurate variant, denoted RKU or RKU1.
%
% This collection of methods have stability polynomials
% R(z;s) = U(1 + 3*z/(s*(s+2));s) / (s... |
function P = isIntersectWall(wall, line)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
P = 0;
for i=1:+1:size(wall,1)
P_tmp = intersectionTwoLines(wall(i,:),line);
if size(P_tmp,2) > 1
if isIntersectSegment(wall(i,:),P_tmp(1),P_tmp(2));
... |
function [I3] = butterworth_noise_filter(I2,f_c)
[nx,ny] = size(I2);
Fs = 100; % made up sampling frequency
T = 1/Fs; % sampling period
L = nx*ny; % length of signal
t = (0:L-1)*T; % time vector
X = double(reshape(I2, 1, L)); % signal
% figure()
% plot(t,X)
% title('Noisy signal')
% xlabel('t, s')
% ylabel('color')... |
function [erp] = extract_averages(innamebeg,subnames,innameend,outname,rsrate,domain,blsms,blems,startms,endms,P1,P2,OPTIONS,AT,catcodes2extract,elecs2extract,verbose),
% [erp] = extract_averages(innamebeg,subnames,innameend,outname,rsrate,domain,blsms,blems,startms,endms,P1,P2,OPTIONS,AT,catcodes2extract,elecs2extra... |
function spc_updateMainStrings
global spc;
global gui;
%global spcs;
if isfield(gui, 'spc')
if isfield(gui.spc, 'spc_main')
handles = gui.spc.spc_main;
if ~spc.switches.noSPC
range = round(spc.fit(spc.currentChannel).range.*spc.datainfo.psPerUnit/100)/10;
set(handles.spc_fitstart,... |
% Problem 3 (d)
% Marty Fuhry
% 2/13/2011
% Compiled and ran using GNU Octave, version 3.2.4 configured for "x86_64-pc-linux-gnu".
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Consider the heat equation %
% u_t = k u_xx ... |
function c = config_getbestnoveltyconfig(dataset)
if nargin < 1
dataset = 1;
end
cfg = load('config/config_novelty-best_24-Sep-2014.mat');
c = cfg.nov_config;
c.memory_efficient = 1;
c.dataset = dataset;
end |
% The SaFIN model is written by Tung Sau Wai.
% Please cite the paper when using this code:
% S.W. Tung, C. Quek and C. Guan, "SaFIN: A Self-Adaptive Fuzzy Inference
% Network," IEEE Trans. on Neural Netw., 22(12), pp. 1928-1940, Dec. 2011.
% This is the main file for running the SaFIN model.
% There are 3 ways of usi... |
%uppgift 6
clear all
clc
%(x1-X)^2 + (y1-Y)^2 = R^2
%(x1-c2/2)^2 + (y1-c3/2)^2 = R^2
% x1^2 - x1*c2 + (c2^2)/4 + y1^2 - y1*c3 + (c3^2)/4 = R^2
% x1^2 + y1^2 = R^2 - (c2^2)/4 - (c3^2)/4
% skriver c1 som: c1 = R^2 - (c2^2)/4 - (c3^2)/4
% Vilket ger x1^2 + y1^2 = c1 + c2*x1 + c3*y1
xm = [4; 10; 8];
ym = [8; 2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.