text
stringlengths
8
6.12M
function [trainIdx,testIdx] = stratifiedIndices(DmatY,proportionTrain) classes = unique(DmatY); trainIdx = cell(1,numel(classes)); testIdx = cell(1,numel(classes)); for d = 1:numel(classes) classidx = find(DmatY==classes(d)); shuffIdx = classidx(randperm(length(classidx))); trainIdx{d} = shuffIdx(...
mispracticas; [t, u]= mirk4(tinic, tfin, N, x0, fun, par); misgraficas;
function fighandle=dockfig(varargin) % fighandle=dockfig(figs) DOCK one or more FIGures. % "fighandle" is an array of handle numbers for the figures. % "figs" is an array of figure handles. % If "figs" is empty then all figures are docked. % Examples: % figh=dockfig([4,3,5]), dockfig, dock...
%% Gaussian function GaussianBlur(GreyWindowWidth, sigma) fprintf('\n高斯模糊处理中···\n'); global img hImage skin; skin = SkinDetection(img,0); img_a = imfilter(img,fspecial('gaussian',double(int32(GreyWindowWidth)),sigma)); img_a = uint8(skin).*img_a; img_b = uint8(~skin).*img; img = img_...
function [final_p_clique, final_m_clique, final_pm_clique] = prune_2cliques_complex(vote_both, kinship2, posteriorIBD1, posterior, pairs) final_p_clique = []; final_m_clique = []; final_pm_clique = []; len = length(vote_both); if( len == 1 ) final_pm_clique = vote_both; return; else final_pm_clique = vot...
function [y,indices] = chitest(x,media,covaria,t) % CHITEST - Test Chi-cuadrado % Determina las muestras de una poblacion cuya distancia de % Mahalanobis es menor que el parametro de test % % [y,indices] = chitest(x,media,covaria,test_parameter) % % y : muestras que cumplen el...
classdef (Abstract) rlAbstractSolver % RLABSTRACTSOLVER Abstract RL solver for framework 2.0 dlnetwork. % Copyright 2019 The MathWorks, Inc. % This utility will be replaced with DLT FW2.0 external feature. methods (Abstract) % LearnableParameters = calculateUpdate(this,Lear...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Simple script that performs Y = X + 1. % To run in serial without distributed arrays, set % PARALLEL = 0 % At the Matlab prompt type % pAddOne % To run in serial with distributed arrays, set % PARALLEL = 1 % At the Matlab prompt type % pAddOne %...
function [ outputArg ] = tapply( x, list, fName, options, isEvalOption ) % This is a 'dirty' quivalent of the R function % Apply a function to each (non-empty) group of values given by a unique combination of the % levels of certain factors. % % IN: % x : a vector % list : a cell of one or more factors, each of...
function viralAssemblyModel () %% Initial Conditions % We're setting everything to 0 except the first variable % The first variable is the copy number of gapped DNA in the nucleus % This simulates the initial infection initial = zeros(18,1); initial(1) = 0.0001; vol = 75; % Volume of cell %% Run the simulati...
function [x] = GaussPP(M,b) %GAUSSPP A function to perform gaussian elimination % Utilizaes partial pivoting in gaussian elimination % This does not keep track of the r vector for performance A = [M b]; n = size(A); n = n(1); % Diagonal iterator for i = 1:(n-1) % Partial pivot to max value in the i c...
function draw_varianceplot(para,title_string,filename,gmmhmm_projectroot,store_path,varargin) num_of_dists=size(para,2); disp(num_of_dists); figure('Name',['Prec. Recl. Plot for ',title_string],'Visible','On'); hold on; hline = findobj(gcf, 'type', 'line'); set(hline, 'linewidth', 3); styles...
function [mwloads, sloads, sresps, mresps]=simul_main(d,N,lam,jtype,sp1,sp2,tau,svals,nruns,runlen) % jtype =1 => Exponential with mean 1 % jtype =2 => Hyperexponential with mean=1, SCV=sp1, f=sp2 % jtype =3 => Power law jobs with \bar G(w)=w^(-2) => E[G]=2! % jtype =4 => Deterministic jobs of size 1 % tau = delay on t...
close all clc;clear; %The first problem num = [1 1.3 2 2.5]; den = [1 0.3 1.2 1]; [A,B,C,D] = tf2ss(num,den); [z,p,k] = tf2zp(num,den); %The second problem num1 = 0.5; den1 = [0.1 1 0]; den2 = [0.05 1]; [A1,B1,C1,D1] = tf2ss(num1,den1); [A2,B2,C2,D2] = tf2ss(num1,den2); [A3,B3,C3,D3] = series(A1,B1,C1,D1,A2,B2,...
%%%%%%%%%%%%%%%% PLOT SHAPES %%%%%%%%%%%%%%%% % Plots space-time plots. % Inputs: % plotST - sets the type of plots to make % options: 'plotFour' - plot the local and global shape and motion measures % options: 'trackingArrow' - plots the tracking mapping % ...
function [fnames, neuroncount, conv, fnames_pos, neuroncount_pos, conv_pos, int_pos, pos_pos,... fnames_neg, neuroncount_neg, conv_neg, int_neg, pos_neg] = Zfactor_script %First locate the Excel file that CellProfiler spits out (use the one with %the suffix "Image" [filename, pathname, filterindex] = uigetfile('*....
function [u1_val,u2_val,I_val,sigma_s2] = get_uI(img_patch,mean_s) % close all; % figure; % imshow(img_patch); I_val = mean(mean(img_patch)); [m,n] = size(img_patch); sigma_s2 = 0; k = 0; for row=1:m-1 for col=1:n-1 k = k + 1; sigma_s2 = sigma_s2 + (i...
function [cohval, sigval, bootcoh] = bandcoh(freq1,freq2,cohall,cohbootall,freqsout) [~, minidx] = min(abs(freqsout-freq1)); a=minidx; [~, minidx] = min(abs(freqsout-freq2)); b=minidx; cohall = cohall(a:b,:); cohbootall = cohbootall(:,a:b,:); % %take max over time % cohval = max(max(cohall,[],2)); % boot...
% Choosing Lenet model as Baseline model % Specify files to import protofile = 'lenet.prototxt'; datafile = 'lenet_iter_10000.caffemodel'; % Import network net = importCaffeNetwork(protofile,datafile) %Splitting dataset into training & testing data XTrain = loadMNISTImages('train-images.idx3-ubyte'); YTrain =...
for n = 1:length(data) if ~isempty(data(n).av) tmp = findSpikes(data(n).trace); data(n).spikes = tmp; end end save('complete_dataset.mat', 'data')
close all; % loads: % hovering equilibr ium (xs,us) % continuous time matrices Ac,Bc of the linearization % matrices sys.A, sys.B of the inner-loop discretized with sampling period sys.Ts % outer controller optimizer instance load('quadData.mat') outerController = getOuterController(Ac, 'cplex'); disp('D...
clear all; close all; cd E:\sim\saved % freqzimgs(:,:,:,fr,sc,sb) = zimg; corrs = load('mc_yes_gsr'); corrs = corrs.mc_yes_gsr; temp = zeros(size(corrs,1),size(corrs,2),size(corrs,3),size(corrs,4),4,size(corrs,6)); temp(:,:,:,:,1,:) = squeeze(mean(corrs(:,:,:,:,1:2,:),5)); temp(:,:,:,:,2,:) = squeeze(mean...
%% align data by sm3 method % Author: Xiaochen Qiu from Beihang Univ. % Reference: "Least-Squares Estimation of Transformation Parameters % between Two Point Patterns" % Announcement: Not debug free. Feel free to do any modifications and % use it at will %...
function res=linearf(inp) t=3; inp=imread(inp); in=inp; for i=1:t si=size(inp); res=zeros(si); for j=2:2*si(1)-2 for k=2:2*si(2)-2 a=floor(j/2); b=floor(k/2); res(j,k)=sum(inp(a:a+1,b))/2; end end ...
function [ULcomm_op, radar_op,cov_op] = tsp_altermating_projection_UL... (ULcomm, radar,radar_comm,cov) ell_max = radar.ell_max; ell = 1; radar_op = radar; ULcomm_op = ULcomm; I_total = zeros(ell_max,1); I_total_op = zeros(ell_max,1); I_UL_op = zeros(ell_max,1); I_radar_op = zeros(ell_max,1); I_UL = ULcomm.alpha_UL.*U...
function [t_ref,errors,t_span,X] = test_dynamics_PVTOL_LQR(N_itr,do_plot,model,t_ref,x_opt,u_opt,x0) %Simulate with TV-LQR controller close all; %% Load model if strcmp(model,'ccm') load(strcat('PVTOL_Dyn_Functions_',num2str(N_itr),'_new','.mat')); %f, B else load(strcat('PVTOL_',model,'_Dyn_Functions_',num...
classdef CompareFieldDataFilter < DataFilter % implements an abstract one-field compared to one-value type filter properties(SetAccess=protected) value end methods(Abstract) % return a token describing this comparison, e.g. '==', '>', etc. str = getOperatorString(filt); % ...
function y_out = polyNum(xin,coeffs) sum=0; for k=1:length(coeffs) prod=coeffs(k); for j=1:k-1 prod=prod.*xin; end sum=sum+prod; end y_out=sum; end
classdef InputObj %INPUTOBJ % Object for handling input options and parameters properties ModelParams WaterParams temperature_source chla_source DOC_source MeHg_source tstart tend SpeciesParams SpeciesNames FeedP...
function col = get_col_by_name (head_str, col_str) n = find (head_str == ','); x = min (strfind (head_str, col_str)); col = min (find (n - x > 0));
% This file creates an simplified network outline for the two archipelagos Seaforth_centroids = [ 166.9275 -45.7254 166.8345 -45.7325 166.79 -45.75 166.6955 -45.76 166.58 -45.78 166.625 -45.7...
function [derivt] = derivativet(mat,NodesT,dt) derivt = zeros(NodesT,1); for j = 1:(NodesT) if j == 1 derivt(j) = (mat(j+1)-mat(j))/(dt); else if j == NodesT derivt(j) = (mat(j)-mat(j-1))/(dt); else derivt(j) = (mat(j+1)-mat(j-1))/(2...
function avg = win_average(AVG_WIN, sig_val) mask = ones(1, AVG_WIN)./AVG_WIN; avg = conv(sig_val, mask,'same'); end
% batch script to collect and plot co-occurrence data %% cfg = []; cfg.rats = {'R042','R044','R050'}; cfg.requireCandidates = 1; fd = getTmazeDataPath(cfg); cfg.prefix = 'CC_PRE'; cfg.what = 'SWRz'; % 'SWRz', use only the data for co-occurrence during candidate events cfg.sessions = {'food','water'}; cfg.arms = {'le...
function[state, type] = getstatetype(no1, no2); states = {' Andhra Pradesh',' Arunachal Pradesh',... ' Assam',... ' Bihar',... ' Chhattisgarh',... ' Goa',... ' Gujarat',... ' Haryana',... ' Himachal Pradesh',... ' Jammu and Kashmir',... ' Jharkhand',... ' Karnataka',... ' Ke...
if ( ~exist ( 'VARARGIN_VARIABLES', 'var' ) ) error ( '## VARARGIN assignment script requires variable VARARGIN_VARIABLES' ); end % Get parameters iVarArginAssignmentIdx = 1; while ( iVarArginAssignmentIdx <= length(varargin) ) iVarArginVariableIdx = 1; bFound = false; while ( ~bFound && ( iVarArgi...
function [area,error,ErrorEst] = simpson(x1,x2,fun,df4) h=abs(x2-x1)/2; xm=(x2+x1)/2; area=(h/3)*(fun(x1)+4*fun(xm)+fun(x2)); error=abs(integral(@(x)fun(x),x1,x2)-abs(area)); ErrorEst=abs((x2-x1)^5/90*fminbnd(@(x) -1*df4(x),x1,x2)); end
function pOpt = find_social_opt(follows, langs, logt, constants, global_k, p0) %% Find social opt (quite fast) [n,m] = size(follows); if nargin >= 6 pOpt = p0(1:n); else pOpt = rand(n,1); end options = optimset('GradObj','on','Display','iter',... ...'DerivativeCheck','on',... 'H...
function radar_detectorscript(varargin) %RADAR_DETECTORSCRIPT Controls the Stateflow Markov Chain Demo HTML page % RADAR_DETECTORSCRIPT(action) executes the hyperlink callback associated with % the string action. % %% BUSDEMOSCRIPT(action,blockName) is used for the hiliteblock action. blockName %% contai...
function xl = matL(xl,L,dim,pop_size) l=reshape(L',1,dim); for i=1:pop_size for j=1:dim if l(j)==0 xl(i,j)=0; end end end end
# Traitement d'Image pkg load image # TP5 # 1 - Prise en main [sinus, map_sinus, alpha_sinus] = imread("data/sinus.png"); [monde, map_monde, alpha_monde] = imread("data/monde.png"); [dominos, map_dominos, alpha_dominos] = imread("data/dominos.png"); [lena, map_lena, alpha_lena] = imread("data/Lena_nb.jpg"); [manhat...
function [value] = tobeoptimized(shortened_params) global setts; params = expand(setts, shortened_params); setts.pi0 = params(1,1); setts.sens1 = params(1,2); setts.spec1 = params(1,3); setts.vartheta = params(1,4); if strcmp(setts.object,'mode') [theta, ll, exitflag] = Postmaxest(); elseif strcmp(sett...
function [ A_hat, E_hat, iter, logData ] = inexact_alm_rpca( D, lambda, opts ) % Oct 2009 % This matlab code implements the inexact augmented Lagrange multiplier % method for Robust PCA. % % D - m x n matrix of observations/data (required input) % % lambda - weight on sparse error term in the cost function % % tol - t...
Gr = reducedTransitionMatrix(G); [U, D] = eig(Gr); p0 = zeros(1,5); p0(1) = 1; % duurt lang :( P = U*D^(1000)*inv(U); while norm(p0) > eps p0 = p0*P; end disp(p0);
function [] = printPmtkFigures(filename) printFolder = '/ubc/cs/home/n/nevek/fig'; % create an eps and pdf file for the figure opts = struct('Color', 'rgb', 'Resolution', 1200); exportfig(gcf, sprintf('%s/%s.eps', printFolder, filename), opts, 'Format', 'eps' ); %pdfcrop; % This is the problem exportfig(gcf...
function [theta,J_history] = GradientDescent (X, y, theta, alpha, iter) m = size(X,1); J_history = zeros(iter,1); for i = 1:iter theta = theta - alpha .* X' * (X * theta - y) / m; J_history(i) = CostFunction(theta,X,y); if(mod(i,1000) == 0) fprintf("Iterator : %d Co...
function distance=dist_tanimoto(a, gene_train) % input: a - test sample, gene_train - train set n=length(gene_train); m=length(a); distance=zeros(n,1); for i=1:n count=0; train=gene_train{i}; for j=1:m if a(j)==train(j) count=count+1; end end distance(i...
clear all close all %% Preamble, assigning variables and error checking % This code gives a nonlinear wah-overdrive effect. I will set the % variables so they can't be changedas for this code I just want a relatively nice % sounding distortion effect. [y,Fs] = audioread('Guitar_Sequence.wav'); if size(y,2) == 2 ...
function [vec, addScore] = Merge(vec, direct) addScore = 0; if(direct==3||direct==4) for i = 1:3 if(vec(i)==vec(i+1)) vec(i) = vec(i)*2; addScore = addScore + vec(i); vec(i+1) = 0; end end else for i = 4:-1:2 if(vec(i)==vec(i-1)) ...
% a function which binarizes the image and returns the label matrix and the % boundaries of connected regions function [B,L] = getLabelMatrix(frame) frame = stretch(frame); frame = imsharpen(frame, 'Radius', 2, 'Amount', 2); thres = graythresh(frame); frame = imbinarize(frame, (0.3 + thres)/2); ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Author: Hamza Bourbouh <hamza.bourbouh@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:...
fo=150e3; wo=2*pi*150e3; Ls=66e-6; Cs= 1/(wo^2*Ls); RL= 16; M=17e-6; a1=0.1; M1=M*(1+a1); M2=M*(1-a1); f=1e5:1e2:2e5; w=2*pi*f; Zs=1i*w*Ls+1./(1i*w*Cs); figure(); for RL=16:8:64 Vout1=M1*w.*(RL./(Zs+RL)); plot(f/1000,Vout1,'b'); hold on; end for RL=16:8:64 Vout1=M2*w.*(RL./(Zs+RL...
classdef (HandleCompatible) Cacheable % METHODS CLIENT WOULD CALL: % cache() % loadFromCache() % snapshot(nameOrIndex) % loadFromSnapshot(nameOrIndex) % loadFromSnapshotMostRecent() % loadFromSnapshotMostRecentMatchingParam() % printListSnapshots() methods(Abstract) % retu...
%% DIGITAL IMAGE PROCESSING % Assignment 1 - Summer Semester 2020/2021 % Kavelidis Frantzis Dimitrios - AEM 9351 - kavelids@ece.auth.gr - ECE AUTH function x = imagedequant(q,w1,w2,w3) %% Uses mydequant.m function to dequantize values of colors on an image x(:,:,1) = mydequant(q(:,:,1),w1); x(:,:,2) = ...
%% make the example movie % parameters nx = 80; % horizontal pixels ny = 80; % vertical pixels n = nx * ny; T = 10; % sec dt = 0.01; t = dt:dt:T; sig = 0.1; % magnitude of gaussian noise added % 3 underlying modes [Xgrid, Ygrid] = meshgrid(1:nx, 1:ny); mode1.u = exp(-((Xgrid-40).^2/250+(Ygrid-40).^2/250)); mode1.f =...
function [mssim] = mssim_index(img1, img2,K,L) % Multi-scale SSIM % Input: % img1 - first image % img2 - second image % Output: mssim - mssim value nlevs = 5; % Use Analysis Low Pass filter from Biorthogonal 9/7 Wavelet lod = [0.037828455507260; -0.023849465019560; -0.110624404418440; ... 0.3774028556128...
function Congr(hAxes,Color,NumColor) % Congratulation for k1=1:6, % check any side onesq = Color(k1,:,NumColor(k1,1)); % one square of side for k2=2:9, % check other squares othsq = Color(k1,:,NumColor(k1,k2)); % other square of side if ~all(onesq==othsq), return end end end hFig = ge...
A = load('juli234.txt'); figure plot(A(:,2),A(:,1),'x'); title('任务与任务聚类中心距离-价格图','FontSize',14); xlabel('距离','FontSize',12); ylabel('价格(元)','FontSize',12); %set(gca,'XLim',[0 0.36]);%X轴的数据显示范围 set(gca,'YLim',[65 90]);%X轴的数据显示范围 figure plot(A(:,3),A(:,1),'x'); title('任务与会员聚类中心距离-价格图','FontSize',14); xlabel('距离','FontS...
%See name while clicking on line in figure function show_DisplayName(varargin) hmainFig=gcf; current_line=gcl; %see choosed line xdata=get(current_line,'XData'); ydata=get(current_line,'YData'); %hdt = datacursormode; %set(hdt,'DisplayStyle','window'); %set(hdt,'UpdateFcn',{@labeldtips,xdata,ydata})
function saveContours(~,~, obj) try [dname, fileName] = savePrompt; if ~isempty(dname) for i = 1:length(obj.model.nameList) name = obj.model.nameList{i}; filename = sprintf(fileName, name); tab = Table.create(getPolygonFromName(obj.model, name), {'x', 'y'}); write(tab, fullfile(dname...
function [x,y] = km_kde(data,sigma,nsteps,range_x) % KM_KDE performs kernel density estimation (KDE) on one-dimensional data % http://en.wikipedia.org/wiki/Kernel_density_estimation % % Input: - data: input data, one-dimensional % - sigma: bandwidth (sometimes called "h") % - nsteps: optional...
function p = startTrial(p) %pds.eyelink.startTrial allocate and clear buffer for the next trial % % allocates the data structs and also clears the buffer % % p = startTrial(p) if p.trial.eyelink.use p.trial.eyelink.sampleNum = 0; p.trial.eyelink.eventNum = 0; p.trial.eyelink.drained = f...
function [y]=fp(x,c) % % This function calculates df(x)/dx for a given x and a parameter c. % y=sin(c+x)+exp(x); %
clear; pp = '/Users/huan/Downloads/re-id/dataset/Market1501/bounding_box_test/*.jpg'; %加载属性标注信息 load('market_attribute.mat'); upblack = market_attribute.test.upblack; upwhite = market_attribute.test.upwhite; upred = market_attribute.test.upred; uppurple = market_attribute.test.uppurple; upyellow = market_attribute....
function [ torque_fun ] = torque( nlp ) %torque cost for torque % Creates SymFunction for a torque cost % % Author: Ross Hartley % Date: 2018-03-19 % Compute function for torque cost u = nlp.Plant.Inputs.Control.u; cost = sum((u).^2); torque_fun = SymFunction('torque', cost, {u}); end
load('labels.mat') difference_t = [0; diff(labels)]; blinks = [find(difference_t==1) find(difference_t==-1)]; difference_d = [0; diff(st)]; detected = [find(difference_d==1) find(difference_d==-1)]; tp = 0; fn = 0; for i=1:size(blinks,1) true_sequence = blinks(i,1):blinks(i,2); was_det...
function varargout = histogram(varargin) % GUI for Plotting historgam and equalizing image arrays % % INPUT: % images - array to plot histograms for (can be a single image as well) % 'N' - image to display % % to run: % % histogram(images,'1') % % if want equalized images as output: % % im_eq=thr...
% John Heath % ACM 116 Problem Set 3 % Problem 2, Part C clc; clear; close all; a = 2; b = 6; g = 2; n = 10.^4; % draw all the exposure levels from the beta distribution x = betarnd(a, b, n, 1); % turn exposure levels into probabilities by exponentiating by gamma prob = x.^g; % randomly determine whether they get the d...
%%%%%%%%%%%%%%%%%%%%%%%%%% Rx Data Collection %%%%%%%%%%%%%%%%%%%%%%%%%% %%% Setup for Sound on a Linux Machine (beep doesn't work on Linux) res = 22050; len = 0.2 * res; hz = 400; %%% timeDelay = 0; % delay between each sample startDelay = 0; % delay before the first sample is taken samples = 10; % number of loca...
function Wx=createAllConnectedGraph(X, delta) maxx=max(max(abs(X))); Wx=L2_distance(X/maxx, X/maxx, 0); Wx=exp(-Wx.^2/delta^2); Dxsqrt=1./sqrt(sum(Wx)); Dxsqrt=diag(Dxsqrt); Wx=Dxsqrt*Wx*Dxsqrt; end
function crc_val = crc_ccitt_matlab (message) % Calculates CRC-CCITT bytes for the message which is an array of bytes. % Polynomial = hex2dec('1021'); % Hassan M. Abdar(hassan@case.edu),Farhad kaffashi % Case Western Reserve University, September 2012 crc_table =hex2dec( ['0000';'1189';'2312';'329b';'4624';'57a...
% this isn't finished, but it was an attempt to model cylindrical harmonics % in an optical fiber % SEE Fundamentals of Photonics 2e, Section 9.2 r = linspace(0,10,100); u = zeros(size(r)); u0 = 1; du0 = 0; k_T = 1; K = 2000; a = zeros(1,K); a(1) = 1; a(2) = 0; for k = 3:K a(k) = -k_T^2/(k+1)^2*a(k-2); end for...
function model(X, Y, X_tes, Y_tes, iter, rate) w = init_with_zero(size(X),1); [grad,cost] = prop(w,X,Y); [w,grad,cost] = optimize(w,X,Y,iter,rate); Y_pred = predict(w,X); Y_pred_tes = predict(w,X_tes); fprintf('Akurasi Train: %f\n', mean(double(Y_pred == Y)) * 100); fprintf('Akurasi Test: %f\n', mean(do...
function [ analysis ] = inspect_transitions(varargin) data = load('../kesh/experiments/all.mat','xids'); kwargs = utils.dict(varargin{:}); games = kwargs.get('games',[1:4]); numgames = length(games); subjects = kwargs.get('subjects',[1:9]); numsubjects = length(subjects); xids = kwargs.g...
clear clc L = load('Book2.mat').Book2; T=[L(:,1:19) L(:,21:42)]; t1=table2array(T(:,[1, 5:40])); t2=table2array(T(:,2:4)); t3=table2array(T(:,41)); Temp1=array2table([t1(:,1) grp2idx(t2(:,1)) grp2idx(t2(:,2)) grp2idx(t2(:,3)) t1(:,2:end)]); Temp2=array2table(t3(:,1)); Temp2.Properties.VariableNames{'Var1'...
clear all; close all; vib=textread('I:\bishe实验数据\25600数据\REC3950_ch3.txt','','headerlines',16); pul=textread('I:\bishe实验数据\25600数据\REC3950_ch2.txt','','headerlines',16); pluse1=vib(:,1); vdata=vib(:,2); % pul=pul(:,2);pul=-pul; threshold=abs(1)/3; fs=25600; figure; plot(pluse1,vdata) xlabel('t/s');ylabel('amplitude');t...
function [ hz_f ] = mel2hz( mel_f ) %[ hz_f ] = mel2hz( mel_f ) % Converts frequency in mel to frequency in Hz hz_f = 700*(10.^(mel_f./2595) -1); end
addpath('../lib') true_params = [1,-10,-10,-10,-2,-10,-10]; plt = 1; noise_level = 0.1; repeats = 10; params = true_params; example = 'linear_full_trajectory'; tmp_simulate_function = str2func(['simulate_',example]); for i = 1:4 simulate_function = @(params)tmp_simulate_function(i,[],[],params); [smooth_data,no...
%% create a new screen figure (i.e. a struct with parameters used by screenPlot) function sf = screenFigure(p, startPos, size, windowPointer, xlims,ylims,fontSize,axisColor) %ok, let's not fiddle with pixels, use cm % this will hold all essential information used to scale the data sf.startPo...
% Example of use of "solar" % May 2011, tested on MATLAB R2010A % Translated and improved by Thibaut Leroy (thibaut.leroy@gmail.com), % French solar car team Hélios (http://www.helioscar.com) % HEI (Hautes Etudes d'Ingénieur) engineering school Lille, France % Sunpower datasheets are property of Sunpower Corpor...
function [x, u, Z, sol, zLoop] = main_template(... formula, A, B, Px, Pu, h, X0, Obs, CA_flag, epsilon) % x(t+1) = A*x(t) + B*u(t) % A = dx*dx matrix % b = dx*du matrix % Obs = given as a list of convex polytopes % X0 = d*N matrix time = clock; disp([ 'Started at ', ... num2str(time(4)), ':',... % Returns year as ...
function [D,x0,alpha,result] = Ei200_uvw100_at200mfit() % simplified verification script, which allows one to check % how do sqw cut works %------------------------------------------------- % Parameters : % data_source= fullfile(pwd,'sqw','Data','Fe_ei200.sqw'); bragg = [2,0,0]; % selected bragg % % Cut properties: ...
im=imread('1.png'); imshow(im); g=imnoise(im,'gaussian',0,0.01); figure;imshow(g) imwrite(g,'gaussian.png')
function J = floydSteinbergDithering(I) dim = size(I); J = I; for i = 1:dim(1,1) for j = 1:dim(1,2) orig = J(i,j); if(J(i,j)<128) J(i,j) = 0; else J(i,j) = 255; end diff = orig-J(i,j); if(i<dim(1,1)) J(i+1,j) = J(i+1,j)...
function [q_svd,Q_svd] = qsvd(rN,rB,stddev) % SVD Algorithm for Static State Estimation % Inputs: % rN1 - First Inertial-Frame Reference Position Vector % rN2 - Second Inertial-Frame Reference Position Vector % rB1 - First Body-Frame Measured Position Vector % rB2 - Second Body-Frame Measured ...
function y = MBfnc persistent counter strArray y=1; if isempty(counter) counter = 1; end if isempty(strArray) strArray = [struct('a',multiObjectTracker,'b',multiObjectTracker)]; end obj = multiObjectTracker(); cellOfObj = {obj; obj}; if isempty(cellOfObj) element = struct('a',multiObjectTracker,'b'...
%% Barker ambiguity example % Created by: Lee A. Harrison % On: 4/26/2019 % % Copyright (C) 2019 Artech House (artech@artechhouse.com) % This file is part of Introduction to Radar Using Python and MATLAB % and can not be copied and/or distributed without the express permission of Artech House. clear, clc % Set the pa...
%---------------(i) Simpson・s Method-------------- x0=0; xn=1; n=100000; h=(xn-x0)/n; % step size x1=x0+h; x2=x1+h; sum=0; for i=1:(n/2) fox0=sqrt(1-x0*x0); % f(x0) fox1=sqrt(1-x1*x1); % f(x1) fox2=sqrt(1-x2*x2); % f(x2) sum=sum+(fox0/3+4*fox1/3+fox2/3)*h; % formula of Simpson・s Method x0=x2; x1...
% Lab1 % Regularization % Question 2-3 load data3.mat [B,FitInfo] = lasso(X,Y); [B_LS,FitInfo_LS] = lasso(X,Y, 'Lambda', 0); B_ridge = ridge(Y, X, FitInfo.Lambda); lambda_index = 59; lambda = 0.0633; y = B_LS*ones(size(FitInfo.Lambda)); semilogx(FitInfo.Lambda, B_ridge); hold on plot(FitInfo.Lambd...
function number = count_spikes(data,setting) b = find(data(1,:)==setting); diffb = diff(b); index = find(diffb~=1); number = length(index)+1; end
function [vi,v_std] = itslive_interannual(t,v,v_err,varargin) % itslive_interannual computes the interannual component of velocity variability % for an itslive time series. % %% Syntax % % vi = itslive_interannual(t,v,err) % vi = itslive_interannual(...,'ti',ti) % [vi,v_std] = itslive_interannual(...) % %% Desc...
% filternoise.m filter a noisy signal three ways pkg load signal % must load signal the first time it is called at runtime time=3; % length of time Ts=1/10000; % time interval between samples x=randn(1,time/Ts); % generate noise signal figure(1),plotspec(x...
%% figure5 orig_bp=pwd; example5 bp = '../..'; cd(bp); annotation('textbox', [0.01 0.89 0.05 0.05],'String','a)','LineStyle','none','FontSize',16,'FontName','Times','Color',[0.25 0.25 0.25]) annotation('textbox', [0.01 0.68 0.05 0.05],'String','b)','LineStyle','none','FontSize',16,'FontName','Times','Color',[0.25 0....
numTrials = 125; stimValsRange = [.5,7]; numStimVals = 9; %must be odd stimVals = logspace(log10(stimRange(1)),log10(stimRange(2)),numStimVals); priorAlphaRange = stimVals(1):.5:stimValsRange(2); priorBetaRange = 1:2:30; gammaGuess = .5; lambdaGuess = .02; stair = PAL_AMPM_setup('stimRange',stimVals,... ...
% for phi_rank=1:17 % imagesc(squeeze(Efield_X_map_phi(phi_rank,:,:))) % pause(0.1) % end phi_rank=1 for phi_rank=1:33 imagesc(squeeze(Epot_map_phi(phi_rank,:,:))) pause(0.05) end for phi_rank=2:33 imagesc(squeeze(Epot_map_phi(phi_rank,:,:))) pause(0.05) end % for phi_rank=1:33 % imagesc(squeeze(...
function [v,y,x] = tpf(T,P,z) global Ant v=0.5 ; alpha = 0.5 ; flag=1 ; count=0 ; while flag P_sat = exp(Ant(1,:)-Ant(2,:)./(Ant(3,:)+T)) ; K=P_sat/P ; y = K.*z./((K-1)*v+1) ; x = z./((K-1)*v+1) ; fy = sum(y) ; fx = sum(x) ; f = fy-fx ; if abs(f)<1e-10 flag=0; ...
function rmse = rmse(y, z) % rmse(y,z) - returns Root Mean Square Error X = (y(:) - z(:)).^2; X(isnan(X)) = 0; X(isinf(X)) = 0; rmse = sqrt(mean(X)); end
%filter Rata - rata F = imread('C:\Users\ignatha\Documents\MATLAB\bintik.jpg'); [tinggi, lebar] = size(F); F2 = double(F); G=F; for baris=2 : tinggi-1 for kolom=2 : lebar-1 jum = F2(baris-1, kolom-1)+ ... F2(baris-1, kolom) + ... F2(baris-1, kolom+1) + ... F2(baris, kolom-1) + ......
format long g clc ; clear ; close all ; addpath Functions c = 299792458 ; % 光速(m/s) lambda = c /(1575.42*10^6) ; Data = 0427 ; obs_flag = 1 ; converge_time = 3000000 ; initial_time = converge_time + 20 ; smaller_than_elevation = 10 ; %仰角小於elevation即濾掉 interpolation_or...
function dest = transformEdge(edge, trans) %TRANSFORMEDGE Transform an edge with an affine transform. % % EDGE2 = transformEdge(EDGE1, TRANS); % where EDGE1 has the form [x1 y1 x2 y1], and TRANS is a transformation % matrix, return the edge transformed with affine transform TRANS. % % Format of TRANS ca...