text stringlengths 8 6.12M |
|---|
function J = gtrack_computeJacobian(S_apr)
x = S_apr(1);
y = S_apr(2);
z = S_apr(3);
v_x = S_apr(4);
v_y = S_apr(5);
v_z = S_apr(6);
r = sqrt(x^2+y^2+z^2);
J = [x/r , y/r ,z/r,0,0,0,0,0,0;
y/(x^2+y^2) , -x/(x^2+y^2),0,0,0,0,0,0,0;
-(x/r^2) * (z/sqrt(x^2+y^2)), -(y/r^2) * (z/sqrt(x^2+y^2)), sqrt(x^2+y^... |
function v = p_gurobi_AssignmentGame(slv,pfm)
% P_GUROBI_ASSIGNMENTGAME computes from an assignment problem (sl_vec,prof_mat)
% the corresponding symmetric assignment game using gurobimex and Matlab's PCT.
% If the problem is not symmetric, it will be transformed into a symmetric one.
% The assignment game will be der... |
function [ v2, lambda2 ] = MyPower2( A )
B = A'*A;
x = rand(length(A),1);
v = x/norm(x);
for k = 2:100
vtemp = B*v;
lambda1 = dot(vtemp,v);
v = vtemp/norm(vtemp);
end
newx = x - dot(x,v)*v;
v2 = newx/norm(newx);
for k = 2:1000
v2temp =B*v2;
if mod(k,4) == 0
v2tem... |
function x=tswopLocalSearch(proposalFunc,startingX,epsilon,lowerBoundOnX,upperBoundOnX,timeDelta,funcDelta,N)
% This general-purpose optimization routine aims to minimize funcToOptimize
% starting from the initial guess startingX, via proposals generated by
% proposalFunc (the two functions are specified via function h... |
function [ output_args ] = estimateDerivative( state )
% State is composed of [ vel x3, pos x3, angle x3 ]
% So derivative is [ accel x3, vel x3, angular vel x3]
% Transform local acelerations to global space
% and local rotations to a rotation matrix
end
|
classdef DirichletProcessModel
%see: http://rajarshd.github.io/talks/DPGMM_tutorial.pdf
properties
mu_0
kappa_0
nu_0
S_0
mu
kappa
nu
S
x_s
S_part
N
setIdx
end
methods
func... |
% This script performs subject-specific analyses. In particular it produces
% a subject-specific figure specifying the trajectory of the finger in each
% sequence (both in the triangle and as a cumulative Barycentric
% coordinates plot) as well as the responses (s)he gave at the
% post-sequence questions.
%
% Copyrigh... |
%% global variables
global int
global lat
int = 'interpreter';
lat = 'latex';
R = 10000;% Ratio of noise to signal
n = 512;% number of terms of filter
H = @H1;% function to calculate the optimum frf
t = 0 : 20000;% time
%% ideal H
figure(1)
N = 1000;
alpha = pi / 3;
omega = linspace(0, pi, N);
H_ideal = heaviside(omega... |
%% 进化逆转函数
%输入
% XSel 被选择的个体
% D 个城市的距离矩阵
% 输出
% XSel 进化逆转后的个体
function YSel=Reverse01(YSel,D,delta,alpha1,alpha2,beta1,beta2,theta,tag)
[NSel,CityNum]=size(YSel);
for i=1:NSel
route=YSel(i,:);
fx=Fitness(route,D,delta,alpha1,alpha2,beta1,beta2,theta,tag);
r1=randi(CityNum-2)+1; % 不包括首末节点
r2=ra... |
function hFig = visualizeSpatialPoolingScheme(xaxis, yaxis, spatialModulation, ...
spatialPoolingKernelParams, spatialPoolingFilter, coneLocsInDegs, mosaicFOVDegs, stimulusFOVDegs, coneRadiusMicrons)
zLevels = [0.025:0.05:1.0];
zLevels = [-fliplr(zLevels) zLevels];
mic... |
function varargout = clipPoints3d(points, shape, varargin)
%CLIPPOINTS3D Clip a set of points by a box or other 3d shapes.
%
% CLIP = clipPoints3d(POINTS, BOX);
% Returns the set of points which are located inside of the box BOX.
%
% [CLIP, IND] = clipPoints3d(POINTS, BOX);
% Also returns the indices of ... |
function [lgraph] =resnet18basic(imsize,numClasses)
%Resnet18
%Enter your code here
%%%%%%%%%%%%%%%%%%%%%%
end
|
function buffer = gen_kick_buffer()
% GEN_KICK_BUFFER generates a duration that takes an agent to kick the ball.
% BUFFER is the number of cycle.
global kick_buf_mu kick_buf_sig;
buffer=round(normrnd(kick_buf_mu, kick_buf_sig));
if buffer<0
buffer=0;
end
end
|
function grad = q2_gradient(Xtrain, Ytrain, theta)
% Compute the gradient of the log likelihood at theta
% INPUT
% Xtrain : [m x n] matrix, where each row is a n-dimensional input example (assume it
% already contains the constant feature set to 1)
% Ytrain : [m x 1] vector, where the i-th element is t... |
clear; clc; close all;
rng(0); % used for reproducibility
[a, b] = deal(-1, 0);
m = 64; % number of subintervals per dimension (per square domain)
fem_type = 0; % 0 for triangle and 1 for square
if ( fem_type )
[h, ne, n, coo1, con1, bounds1] = qfem_discretize(a, b, m);
else
[h, ne, n, coo1, con1, bound... |
function pre_process(path_in_EDJ, path_in_OES, path_in_LM, HS_filename, ratio, path_out, path_out_EDJ, path_out_OES)
% Usage : pre_process(path_in_EDJ, path_in_OES, path_in_LM, HS_filename, ratio, path_out, path_out_EDJ, path_out_OES)
% param :
% path_in_EDJ : string => directory that contains all the dentine surfa... |
#engineeringMathematics
#Q 1.38
clear;
clf;
f=@(x,y) 1+3*x^2;
h=0.1;
x(1)=0;
y(1)=2;
for i=1:5;
x(i+1)=x(i)+h;
y(i+1)=y(i)+h*f(x(i),y(i));
endfor
#keuler=rot90((x,y),-1);
kkeuler=rot90([x;y],-1);
keuler=rot90([x,y],-1);
kkk=fopen("Q38.txt","w");
for i=1:5;
fdisp(kkk,[x(i),y(i)]);
endfor
fclose(kkk);
kkeuler
|
function [even_along_vess, random_ntecs, actual_ntecs, results_table] = distributionfromntecs_func(vessels_labeled_segs, binary_hs_image, skel_img, dapi_img, px_per_um, save_dir,sample_name)
tic
shortfile = sample_name;
display(['Analyzing nanoparticle distribution for ' shortfile])
vess_seg = vessels_labeled_seg... |
function [florisRunner] = generateFlorisRunner(layout)
% Generate temporary ambient conditions
layout.ambientInflow = ambient_inflow_uniform('windSpeed', 8.0, ...
'windDirection', 0, 'TI0', 0.06);
% Make a controlObject for this layout
if any(strcmp(layout.uniqueTurbineTypes.allowableControlMethods,'yawAndRelPowe... |
function fcfs()
t1=0;
t2=0;
n=4; %no of processes
btime=[ 2 3 1 5]; %burst time
wtime=zeros(1,n); %waiting time
tatime=zeros(1,n); %turn around time
for i=2:1:n
wtime(i)=btime(i-1)+wtime(i-1); %waiting time will be sum of burst time of previous process and waiting time of previou... |
function [ID1, max_corr] = SSS_detect(sss, nid_2, channel,ifft_size)
global SSS_ALLOCATED_LENGTH
len = 127;
sss_rx_freq = deofdm(sss,SSS_ALLOCATED_LENGTH,ifft_size); %144¸öµã
sss_freq = sss_rx_freq(ceil((SSS_ALLOCATED_LENGTH-len)/2)+1:ceil((SSS_ALLOCATED_LENGTH-len)/2)+len);
sss_after_estmate = real(sss_freq./channel)... |
% Apply RealismCNN model directly on human evaluation dataset.
% This script can reproduce RealismCNN results in Table 1.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% add paths
SetPaths;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% set parameters
EXPR_NAME = 'Reali... |
function [A]=matrizCoeficientesA(nombreCompuesto)
if isstring(nombreCompuesto)
convertStringsToChars(nombreCompuesto);
end
%strNombreCompuestos=["GYPANHDOL","ArcillaDOLSIL","DOLCALSIL", "SalSIL","FI2DOLDOLCaCO", "FI2CaCOCaCODOL", "FI2CaCOCaCOSil", "FI2SilSilCaCO"];
%{
VectorIndependiente
DT
NPHI
RHOB
1
%}
switch ... |
%% MAIN PSO
%% TO CLEAR VARIABLES
varsbefore = who; %// get names of current variables
% CLEAR: all workspace and global variables, and close all figues
%clearvars -global; clearvars; close all; clc;
%% LOAD NECESSARY CODE
addpath('pso_tools');
addpath('plant');
addpath('simulink');
%% LOOP TO CH... |
%Clearing Command Window
clc;
clear all;
%Computed Variables From Gear Code
WHt=585.3; %Gear Forces, helical
WHr=200.2;
dB=1.083; %Gear pitch diameters
%Shaft distances between points of interest, *********these were updated for the bearings***********
L1=1.0862;
L2=2.5724;
Lf=1.0862; %distance to... |
% function from deep irf to DC:
function [Gdc]=get_dc_irf(M,bigC,G,FT,HS,az)
M = rot_nez2rtz(M,az);
fmax=FT.Fmax;
N=FT.nwin;
df=FT.df;
Gdc=zeros(3,N);
Gh=zeros(size(G));U=zeros(3,N);
for k=1:9
Gh(k,:)=fft(G(k,:)*1E-14); % this conversion comes from converting all velocities from km/s to m/s
end
w =zeros(N,1);
fo... |
function [time_points text_labels] = load_annotation(filename, fileformat)
% function [timepoints labels] = load_annotation(filename, fileformat)
%
% This function loads the file with FILENAME and determines the
% onset TIMEPOINTS of each section, as well as the LABEL assigned
% to each section. The format can... |
function [k, num, den] = parseCellValues(cellIn)
% A parser for changing the input of cell variables into usable arrays
% input
% cellIn = the input values in cell format, num and den
% output
% num = numerator of cellIn value, the first one
% den = denumeratir cellIn value, second... |
function [] = firstAndLastIVMPulseIntegratorP2X4G45A(ton,toff,Ttot,model)
global A J err IVMon IVMoff Acell A0 J0;
global k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 k12 k13 k14 k15 k16 k17 k18 L1 L2 L3 L4 H1 H2 H3 H4 alpha
global Tfirst Ifirst Yfirst Tlast Ilast Ylast
A0=A;
J0=J;
Imax=0;
naive=model.naiv... |
function VPI=valueOfPerfectInformation(mu,sigma,c)
%mu: vector of expected values of the returns of all possible actions
%sigma: corresponding standard deviations
%c: index of the action about which perfect information is being obtained
[mu_sorted,pos_sorted]=sort(mu,'descend');
max_val=mu_sorted(1);
max_pos=pos_sort... |
function feapath = get_fea_dir(feadir)
% generate the image paths and the corresponding image labels
% written by Liefeng Bo on 01/04/2011 in University of Washington
% subdirectory
feaname = bodir(feadir);
if length(feaname)
for i = 1:length(feaname)
% generate image paths
feapath{1,i} = [feadir '/' ... |
% mlrExportROI.m
%
% $Id$
% usage: mlrExportROI(v,saveFilename,<'hdr',hdr>,<'exportToFreesurferLabel',true/false>)
% by: justin gardner
% date: 07/14/09
% purpose: Export ROI(s) to a nifti image or Freesurfer label file. Uses
% current roi(s) and current base in view to export.... |
function out1 = HeelSpringDeflectionEst(q4,q5,q6)
%HEELSPRINGDEFLECTIONEST
% OUT1 = HEELSPRINGDEFLECTIONEST(Q4,Q5,Q6)
% This function was generated by the Symbolic Math Toolbox version 7.1.
% 22-Aug-2019 16:26:24
t2 = cos(q6);
t3 = cos(q4);
t4 = cos(q5);
t5 = sin(q4);
t6 = sin(q5);
t7 = t3.*t6;
t8 = t4.*t5;
... |
% The MIT License (MIT)
%
% Copyright (c) 2016 Paul Watkins, National Institutes of Health / NINDS
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including without lim... |
clc;
clear;
close all;
cyc = 5;
for count = 0:cyc
OnenetWS;
OnenetWOS;
testone;
net23withsmote;
s1 = ['stanws.n',num2str(count),' = result2;'];
s2 = ['stanwos.n',num2str(count),' = result;'];
s3 = ['owos.n',num2str(count),' = num;'];
s4 = ['ows.n',num2str(count),' = num2;'];
eval... |
clear; close all;
force_filename = './data/loadcell_1.txt';
force_fileID = fopen(force_filename);
force_data = textscan(force_fileID, '%f');
force_data = force_data{1};
semg_filename = './data/semg_1.lvm';
semg_data = lvmread(semg_filename);
% Remove mean
semg_data(:, 2) = semg_data(:, 2) - mean(semg_data(:, 2));
%... |
clc;clear
name = {'MagicTrackPad'; 'HHKB'; 'DellScreen'; 'ScreenBarPlus'; 'XiaomiLight'};
price = {973; 2400; 3600; 999; 269};
ColName = {'Profuct_Name', 'Price'};
Price_table = table(name, price, 'VariableNames', ColName);
Total_cost = sum(cell2mat(Price_table.Price));
|
close all
clear all
% RG1, RG2, RGcomb, JR1, JR2, HH, RO, TH, MW, CK, BK, DM, LJ
subject = 'MW';
switch subject
case 'RG1'
figure(1)
pa_datadir JR-RG-2012-02-22
load JR-RG-2012-02-22-000... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 result = gcl(x)
%GCL Gauss lemniscate cos.
%
% Functions called:
% slcl
[~, result] = gslcl( x);
end
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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:/... |
%----Configuration lines
pkg load all
close all
clear all
clc
if (exist("serial") == 3)
disp("Serial: Supported")
else
disp("Serial: Unsupported")
endif
arduino_serial = serial("COM4", 115200)
set(arduino_serial,'timeout',20)
%-----Read 2048 Samples and process them
no_of_samples=512;
fs=2500;
samples=uint16(... |
function [xsave] = sampleTrajectoryGPU3parallelDim(px, hyp, ...
mean_factor, var_factor, start_states, polpar, s, steps)
%
% Matrix multiplication version of trajectory sampling with a SPGP model on GPU.
%
% Inputs:
% px: pseudo inputs [m, d]
% hyp: log hyper parameters (b, c, sig) [d+2, dim]
% mean_factor: par... |
%Guillermo Santiago Novoa P?rez
%%
function[x, k] = GCPre(A,b,L,x0,tol,maxiter)
%%
k = 0;
n = length(b);
%iid = eye(n);
x = x0;
r = A*x-b;
%d = -r;
y = L'\r;
y = L\y;
%rr = r'*r;
ry = r'*y;
d = -y;
normr0 = norm(r);
normrr = norm(r);
%
%%
while(normrr> normr0*tol && k <= maxiter)
Ad = A*d;
dAd =... |
disp("Problem 4")
disp("See function below")
disp("Problem 5")
disp("Part a")
syms f(x)
f(x) = x^5;
n = 1;
disp("n=")
disp(n)
c = 0;
d = 1;
int = eval_integral(f, c, d, n);
disp("Estimated integral:")
disp(vpa(int))
n = 2;
disp("n=")
disp(n)
c = 0;
d = 1;
int = eval_integral(f, c, d, n);
disp("Estimated integral:"... |
% compute the mean value of depth after fusion for each Radar node.
count_vertices = zeros(size(R_vertices, 1), 1);
mean_vertices = zeros(size(R_vertices, 1), 1);
for i = 1: I_height
for j = 1: I_width
if voronoi_map(i, j) ~= 0
mean_vertices(voronoi_map(i, j)) = mean_vertices(voronoi_map(i, j)... |
close all, clear all,
N=1000;
K=10;
p=[0.35 0.65];
x=zeros(1,N);
y=zeros(1,N);
for i=1:N
if rand()<0.35
x(1,i) = normrnd(0,1);
x(2,i) = normrnd(0,1);
y(i) = -1;
else
r = rand()+2;
o = rand()*2*pi-pi;
x(1,i) =cos(o)*r;
x(2,i) =sin(o)*r;
... |
clear global
fs = sensorFs.imuUpdateFs;
filterOpt.enable.marg = 1;
filterOpt.enable.ahrs10 = 0;
filterOpt.enable.errorstate = 0;
filterOpt.enable.ecompass = 0;
filterRes.IMU.q = zeros(N,1,'like',quaternion());
filterRes.IMU.gyro = zeros(N,3);
q_ecompass = zeros(N,1,'like',quaternion());
filterRes.MARG.q = zeros(N,1,... |
%EEE 511 FALL 2017
%PROJECT 1
%TEAM 9 (511NINERS)
%DANIEL F. BOWDEN, MEINRAD A. CHARLES, VIVEK K. SHARMA
%SUBMITTED 10/15/2017
close all;
clear all;
clc
rng(25)
[x_train1,y_train1,t_train1,x1_nomix,y1_nomix]=arc_generator(1000,2,10,6);
[x_test1,y_test1,t_test1,~,~]=arc_generator(500,2,10,6);
[tr1,bound1... |
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
% Digital Waveguide Mesh
%
% Author: Chad McKell
% Date: 20 March 2020
% Place: University of California San Diego
%
% Description: This script implements a digital waveguide mesh
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... |
%% Plotting a single correlation scatter plot
%This script is separate from the main pipeline, and
%provides additional functionality for plotting the correlation
%scatter plot of any single postdrug epoch of any feature. The selection
%process is handled with dialog boxes. Before running this, you need to have
... |
function intParam = ExtToInt(obj,extParam,extDir,extPW)
% obj = object (type Geometry, LevelSet, Freeform) with defined external coordinates
% extParam = vector of values to convert
% extDir = vector of directions of each (i.e. [x,y,x,z] would be [1,2,1,3])
% extPW = vector of whether point or width to chan... |
clear;
nmos3 = csvread('../data/experiment1_transistor3_4.csv', 1);
[Is, VT, kappa] = ekvfit(nmos3(100:1000,1), nmos3(100:1000,2), 1e-3, 'on')
% Is =
% VT =
% kappa = |
function [z,A,B,C,G,kd,rd] = bde2mep(a,b,p,q,r,s,t,bc,N,opts)
%BDE2MEP Discretizes 2-parameter BDE using Chebyshev collocation
%
% [x,zt,A,B,C,G,kd,rd] = BDE2MEP(a,b,p,q,r,s,t,bc,N,opts) discretizes a two-parameter DE
%
% p(x)y''(x) + q(x)y'(x) + r(x)y(x) = lambda s(x)y(x) + mu t(x)y(x)
%
% with boundary conditon... |
function [pIndex C sse] = kPortfolio(x,avgN,avgRange)
% Create a kMeans Clustered Portfolio (High Values are Preferential)
% <a href="matlab:web('http://kpei.me/blog')">Created by Kevin Pei</a>
% INPUT %
% x - Data Matrix -> each row should be an asset with its characteristics
% avgN - Average n... |
function res = killer(n,p)
persistent plist rd
plist = [plist p];
switch n
case 1
res = 'cooperate';
plist = p;
rd = 0;
case 20
res = 'defect';
otherwise
if any( (plist(n-1:n)==1) + (plist(n-1:n)==5) ) && rd<5
res = 'defect';
r... |
curr_path = pwd;
curr_path = [curr_path,'\Result'];
curr_path2 = [curr_path,'\Results.txt'];
frep = fopen(curr_path2,'a');
fprintf(frep,' \n');
filename = ' ';
running = 0;
S = 5;
N_iter = 1000;
N_initial = 200;
N_training = N_initial;
%lambda = sqrt(2*log2(data.dim));
lambda=0.01;
N_vali = 50000;
Run... |
function varargout = form(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @form_OpeningFcn, ...
'gui_OutputFcn', @form_OutputFcn, ...
'gui_LayoutFcn', []... |
function [ r ] = rotation_x( om ) % angle Roll around X axis!
r=[1 0 0;0 cos(om) sin(om);0 -sin(om) cos(om)];
end
|
function [handles,resultantI] = overlayMaskAdjustments(handles,currentI)
%OVERLAYMASKADJUSTMENTS Crops image and adjusts contrasts of mask.
% handles = OVERLAYMASKADJUSTMENTS(handles) returns handles of the GUI
% with updates to the original ultrasound image in the main axis. This
% image - depending on UI in... |
function r = forcingd3fdx2dp(t,fd_cell,p,more)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% forcingd3fdx2dp
%
% forcing function estimation
%
% third derivative with respect to smooth (twice) and forcing coefficents.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
%PLOTPRIOR Show a model's prior
% This allows you to visualize the entire prior (what you
% believe about the parameters, before you see any data).
%
% figHand = PlotPrior(model)
function figHand = PlotPrior(model)
priorModel = EnsureAllModelMethods(model);
priorModel.pdf = @(data, varargin)(1);
priorModel.lo... |
%OSIPdemo.m
% Purpose:
% 1) Test the functions related to the OSIP of TPSA.
% 2) Show you many examples of the usage of OSIP package for TPSA.
%-------------------------------------------------------------------------------
% Author:
% Chang, Ho-Ping (also written as Ho-Ping Chang or Peace Chang)
% National Synchrotr... |
function [ceza] = esitEsitKontrol (kisitlar, kontrolNoktasi,hassasiyet)
[~, kisitSize] = size(kisitlar);
ceza = 0;
for i=1:kisitSize
if ~(kontrolNoktasi+hassasiyet >= kisitlar(i) && kontrolNoktasi-hassasiyet <= kisitlar(i))
ceza = ceza + abs(kisitlar(i));
end
end
end |
% function outSpikes = learnChannel(inSpikes, n, convergence) learns a
% communication channel between an ensemble with a given spike pattern and
% a new output ensemble of LIF neurons, and returns the spikes of the
% output ensemble.
%
% inSpikes: spikes of the presynaptic ensemble
% n: size of the post-synaptic L... |
%seeder
rng('shuffle');
%data
samples = csvread('wine.csv');
%parameter
n_cluster = 3;
init_tao = 0.01;
rho = 0.5;
ant_quantity = 50;
max_cycle = 2000;
pls = 0.01;
q = 0.98;
best_quantity = round(ant_quantity * 20/100);
%inisialisasi tao
tao = ones(size(samples,1), n_cluster) * init_tao;
ants(ant_quantity,1) = Ant... |
clc;
close all;
clear all;
format long;
bit_count = 10000;
Eb_No = -3: 1: 30;
SNR = Eb_No + 10*log10(2);
for aa = 1: 1: length(SNR)
T_Errors = 0;
T_bits = 0;
while T_Errors < 100
uncoded_bits = round(rand(1,bit_count));
B1 = uncoded_bits(1:2:end);
B2 = uncoded_bits(2:2:end);
qpsk_sig = ((B1==0).*(B2==0)*(... |
function daisyPrint(fileName, fig2bePrinted, plotPath)
% Suggested to use it as daisyPrint(mfilename)
%
% User: mreza
% Project name: stuck
% Project area: /proj/es/shekes/stuck
%
% Department of Electrical Engineering
% Linkoping University
%
% Fri Oct 21 23:10:31 CEST 2011
%
% specify mfilename in ... |
% book : Signals and Systems Laboratory with MATLAB
% authors : Alex Palamides & Anastasia Veloni
%
%
% Laplace Transform properties
%linearity
syms t s
x1=exp(-t);
x2=cos(t);
a1=3;
a2=4;
Le=a1*x1+a2*x2;
Left=laplace(Le,s)
X1=laplace(x1);
X2=laplace... |
clear
clc
n = 10000;
X = zeros(1,n);
Y = X;
X2 = X;
Y2 = X;
for k = 1:n
x2 = 0;
y2 = 0;
for i=1:length(X)
test = rand();
if(test < 0.333333)
x = 1;
elseif(test > 0.666666)
x = -1;
else
x = 0;
end
test = rand();
if(test < 0.333333)
y = 1;
elseif(test >... |
dh=0.01;Ne=80;
start_time=1;
end_time=length(rho);
range=length(rho);
% sigma=50;
sigma_w=sigma/dh;
r_sum=Ne.\[double(sum(rho(1:Ne,start_time:end_time),1));double(sum(rho((numnet-1)*Ne+1:numnet*Ne,start_time:end_time),1))];
dhsigma2=2*sigma_w*sigma_w;
B=1000/(sqrt(2*pi)*sigma);
% tic
interval=10*sigma_w;
exp_factor=B*... |
% exampleC : dialog box created inside a function
% initial rendering is slow because the dialog isn't hidden
function value=DialogExampleC()
% create the dialog
object=SMASH.MUI.Dialog();
object.Name='Example C';
label={'Input file name',' select '};
h=addblock(object,'edit_button',label,40);
FileBox=h(2);
set(h(3),'... |
classdef lamTools %< eltTools
% lamTools with shared functionality :: static class
methods (Static)
% REPLACED BY THE ONE IN psfrTools :: ccorreia 18 April 2019
%% Estimate compressed profile using mean-weighted compression
% function [Cn2eq altEq] = eqLayers(Cn2, al... |
function [prcntDecline] = reductionInFRAllSpots(lpall, modelParam)
prcntDecline=[];
for i=1:length(lpall)
% only one mouse type
if strcmp(lpall(i).mouseType, modelParam.MOUSE_TYPE) == 0
continue
end
lp=lpall(i).lp;
res = checkMapConfitions(lp,modelParam);
if res ... |
function [N,I,B,r] = random_points_on_mesh(V,F,n,varargin)
% RANDOM_POINTS_ON_MESH Uniform random sampling of a mesh.
%
% N = random_points_on_mesh(V,F,n)
% [N,I,B,r] = random_points_on_mesh(V,F,n,'ParameterName',parameter_value,...)
%
% Inputs:
% V #V by dim list of vertex positions
% F #F by 3 l... |
function [ resQ, resV, resultsM ] = Classify( X, Y )
testCount = 5; %ilość przeprowadzanych testów
dataCount = 12; %ilość wyników dla jednego testu
distance = ['euclidean'; 'cityblock'];
resQ = zeros(dataCount, 1); % tablica jakości klasyfikacji
resV = zeros(dataCount, 1); % tablica wariancji
results = zeros(dataCou... |
function update=update()
global u;
global nextu;
global v;
global nextv;
k=.002;
F=2.5;
n=100;
Du=0.0002; %
Dv=0.0001; %
Dh=.01;% spatial res
Dt=.0015;% time step
for x=1:n
for y=1:n
%state-transistion function
uC=u(x,y);
uR=u(modi(x+1,n),y);
uL=u(modi(x-1,n),y);
... |
% images
I1 = imread('mehul.jpeg');
I2 = imread('beard-face.jpg');
I3 = imread('transparent-face-mask.jpg');
% filter
g = fspecial('gaussian',[5 5],1.5);
% Image Plots
subplot(2,3,1), imshow(I1);
subplot(2,3,2), imshow(I2);
subplot(2,3,3), imshow(I3);
% image filtering and displaying
Is1 = imfilter(I1,... |
function out = korelace(a, b);
% funkce pro vypocet korelace
Na = length(a);
Nb = length(b);
if(Na~=Nb)
error('argumets must have the same length');
end
for i=1:Na
acc = 0;
for j=1:Nb-i
acc = acc + a(j)*b(j+i);
end
out(i) = acc;
end |
function tsh = plot_taper(V,E,R,varargin)
% tsh = plot_taper(V,E,R,varargin)
%
% Example:
%
% % (P,C) cubic spline with radii R at control points
% [tV,tE] = spline_to_poly([P R],C,0.1);
% plot_taper(tV(:,1:2),tE,tV(:,3),'FaceColor','r','EdgeColor','none');
if numel(R) == 1
R = repmat(R,size(V,1),1);
... |
% another simple 1D convection example with periodic BC
% diffusion coefficients are defined but not used
% It compares the results of upwind with TVD and shows how diffusive the upwind
% See how diffusive the upwind scheme can be althou it is so bad
% everywhere. Play with flux limiters, time steps, initial condition... |
close all; clc; clear all;
%% To process the cell_compositing_folder in case there are mistakes
fn = 'data\\folders.txt';
folderlist = textread(fn,'%s','delimiter','\n','whitespace','');
newLen = [xx xx xx];
% april21_static_outdoor_kendall
% static_indoor_mixed2
% static_office_bldg400
% static_outdo... |
function [up] = ProjCSimplexGL_Gruobi(u,k,Group,h)
[n,m] = size(u);
g = length(Group);
H1 = eye(n);
f1 = -u;
H2 = zeros(g);
f2 = zeros(g,1);
H = blkdiag(H1, H2);
f = [f1; f2];
gcn = 0;
for i = 1 : g
gcn = gcn + length(Group{i});
end
A1 = ones(1,n);
A2 = zeros(1,g);
for i = 1:g
for j = 1:length(Group{i})
... |
function tree = construct_tree() % define a function to assign random elements forming a tree
p1 = 0.5; % probability of assigning a operator
p2 = 0.7; % probability of assigning a variable x
operators = [1001 1002 1003 1004 1005 1006]; % all operators is assigned by a number
tree = zeros(1,63); % 6 layers tree that h... |
% Puck moving demo
% resolves issue 1
% create world
close all;
fig = figure(1);
world = axes(fig);
world.XLim = [0 320];
world.YLim = [0 200];
world.DataAspectRatio = [1 1 1];
% create puck
figure(2);
puck = plot(0,0,'ko');
puck.MarkerFaceColor = [0 0 0];
puck.MarkerSize = 12;
puck.Parent = world; ... |
function Hd = band_pass(Fstop1,Fpass1,Fpass2,Fstop2,Astop1,Apass,Astop2,Fs)
%BAND_PASS_03 Returns a discrete-time filter object.
% MATLAB Code
% Generated by MATLAB(R) 9.3 and DSP System Toolbox 9.5.
% Generated on: 06-Jul-2018 03:43:06
% Butterworth Bandpass filter designed using FDESIGN.BANDPASS.
% All frequency v... |
function [ eleStrs, eleResult, eleStrsNode] = qt_sd_stress(sdSln, U, QTEle, ele, eleQT, eleSize, eleMat, mat)
nStrComp = 5;
eleStrs = zeros(nStrComp,length(ele));
eleStrsNode = cell(length(ele),1);
eleResult = cell(length(ele),1);
nMat = length(mat);
% nNode = size(coord,1);
% nodalStrs = zeros(nNode,nStrComp)... |
close all;
clear;
%leftImage(:, :) = rgb2gray(imread('cones_left.png')); %Load in the left image
%rightImage(:, :) = rgb2gray(imread('cones_right.png')); %Load in the right image
leftImage(:, :) = rgb2gray(imread('teddy_left.png')); %Load in the left image
rightImage(:, :) = rgb2gray(imread('teddy_right.png'))... |
function saveStream(rootDir, streamName, data, startTimes, stopTimes, labels)
% saveStream(rootDir, streamName, data, startTimes, stopTimes, labels)
STREAMS_SUBDIR_NAME = 'streams/';
DATA_FILE_EXT = '.csv';
STREAM_DATA_FILE_NAME = 'data';
STREAM_ANSWERS_FILE_NAME = 'answers';
numLabeledSubseqs = length(labels);
% de... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author: Trinh, Khanh V <khanh.v.trinh@nasa.gov>
% Notices:
%
% Copyright @ 2020 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration. All
% Rights Reserved.
%
% Disclaimers
%
% No Warranty: ... |
function [r,k,c]=kan_koeff(koeff,varnr,maxvar)
% [r,k,c]=kan_koeff(koeff,varnr,maxvar)
%
% Get channel index for system matrix
% r, k, c are the row, column and coefficients for
% the variables with the variable number varnr.
% maxvar is the number of equations per node.
% koeff are the coefficients
global geom
nin=ge... |
% Update the positions, velocities, accelerations, wave packet widths, and
% wave packet momentums of the particles using the Velocity Verlet algorithm
%
% Parameters:
%
% Velocity Verlet Algorithm
% 1. x(t+dt) = x(t) + v(t) * dt + 0.5 * a(t) * dt * dt
% 2. a(t+dt) = however the forces are computed given the pote... |
function E2 = E_from_t( t,to,a,e )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
GM = 398600.44 * 10^9;
n=sqrt(GM/a^3);
M = (t-to)*n;
E2 = M;
E1 = M+1;
while(abs(E2-E1)<10^-5)
E1 = E2;
E2 = M + e*sin(E1);
end
end
|
% 9000
% Sub to Calculate Therm Coef of Rac & Heatcap & Wind Corr
% Setup Linear Conductor Resistance Eq as Func of Temp
B = (RHI - RLO) / (THI - TLO);
B1 = RLO - B * TLO;
% Setup linear Heat Capacity Eqs as Function of Temp
% Corr Factor (YC) for Non-perpendicular Wind
WINDANG_RAD = pi / 2 - WINDANG_DEG * PIANG;
YC ... |
function [rtn] = getLDPC2(S, P, b)
LDPC = zeros(S, P);
for i = 0:S-1
a = mod(i, P);
b = mod(i+1, P);
LDPC(i+1, a+1) = 1;
LDPC(i+1, b+1) = 1;
end
rtn = gf(LDPC, b); |
%% nmf_MDC_test with more than 3 endmembers
clear all
plot_ = false;
random_ = false;
expTimes = 1;
dataSize = 900;
noiseLevel = 0.001;
bandNum = 6;
emNum = 6;
emTrue = zeros(emNum, bandNum);
emInit = zeros(emNum, bandNum);
emMdc = zeros(emNum, bandNum);
emMvcResult = zeros(emNum, bandNum);
abunTrue = zero... |
%Practice for-loops
%Write a function called halfsum that takes as input a matrix and computes the sum of its elements that are in the diagonal or are to the right of it. The diagonal is defined as the set of those elements whose column and row indexes are the same. In other words, the function adds up the element in t... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Esta funcion resuelve el problema de valor inicial
% u?=f(t,u)
% u(t0)=u0
% utilizandodo un metodo de Taylor de orden 2
%
% [u,t]=Taylor2(f,df,Jf,T,t0,N,u0,b,c,A)
%
% Variables de Entrada:
% f: vector columna. funcion que rige el sistema de EDO,
%... |
% MODI - Projekt 2 - Zadanie 36
% Autor: Jakub Sikora
% Skrypt wykonuje zadanie 1, podpunkt a
% Przejdz do folderu data
folder = pwd();
cd('../')
cd('../')
cd('data')
% Zaladuj plik z danymi
load danestat36.txt
% Powrot do folderu scripts
cd(folder)
% Separacja sygnalow
u = danestat36(1:200,1);
y = danestat36(1:... |
function st = inputCalibration(st)
% Read current values, and substitute defaults if we can't find any.
md = st.Metadata;
calib_fields = { 'X', 'Y', 'T' };
res_val = [1 1 1 1];
units = {'px' 'px' 'frames' };
nf = numel(calib_fields);
for i = 1 : nf
sf = calib_fields{i};
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.