text stringlengths 8 6.12M |
|---|
function NExp=fNExp(C)
%determina exponte de C, de modo que os significativos fiquem na mantissa M fracionaria
if C<1
aux=C;
dif=1;cont=1;
while(aux<1)
cont=cont-1;
aux=aux*10;
end
NExp=cont;
end
if C>1
aux=C;
dif=1;cont=0;
while(aux>1)
cont=cont+1;
aux=aux/10;
end
NExp=cont;
end
end... |
% Given a vector, compare the projection onto the normal of another
% vector vs. the reflection. Note that the projection is 1/2 the
% reflection.
%
% Kurt Motekew
% 2019/02/26
%
close all;
clear;
% Vector to base projection and refelction off of
v = [-.5 -2]';
% Vector to project and reflect
x = [3 2]';
% ... |
function fig_3_d_e_f(data)
%% load data
% proximal.SM.GC_raw = importdata('Proximal_ParametricSweep_GCActivation.csv');
% proximal.tissue.NO_raw = importdata('Proximal_ParametricSweep_PerivascularNO.txt');
% proximal.tissue.dr = 0.1; %interpolate mesh to 1 um
%
% regional.SM.GC_raw = importdata('Regional_Param... |
%{
A function to import the Hypnogram txt files to MATLAB workspace
* Input: Address of the file
* Output: Data - size = 2*N ; N = number of alternation in the sleep
state
Data(1,:): onset time of each state in second
Data(2,:): sleep state:
-1: ?
... |
close all
clear
clc
n = [-6:1:7];
n2=2*min(n):1:2*max(n);
x=[zeros(1,5) 1 1 0 1 1 zeros(1,4)];
h=[zeros(1,4) 1 2 3 2 1 zeros(1,5)];
figure
subplot(2,1,1)
stem(n,x,'.')
subplot(2,1,2)
stem(n,h,'.')
y=conv(x,h);
figure
stem(n2,y,'.','color','r') |
% FLASH30.M - Flicker dartboard for 30 seconds and return to fixation
% spot for 30 seconds.
% The computer display must be in palette mode
% and the refresh frequency=60Hz (for 30 flashing).
config_display( 1, 1, [0 0 0], [1 1 1], 'Arial', 25, 4, 8 )
start_cogent
% prepare the dartboard
preparedartboard(1,20,200,1... |
clear;clc;close all
tic
recdate='Mar_21_13';
cellnum='A';
module='fi_curves';
load([module '_' recdate '_' cellnum])
% trials=1:numel(whos)-3;
trials=[3 4];
sample_rate=10000; % Sample rate in Hz
saveit=1;
[rate,ISI,imp,pulse_duration,pause_duration,delay,increments,currents,deriv_rate]=...
deriv_frequency(modu... |
function output = genTimeFormat(numFrame, frameRate)
% numStartTime = datenum(startTime);
numHourFrame = 3600 * frameRate;
numMinFrame = 60 * frameRate;
numSecondFrame = frameRate;
numFFFframe = mod(numFrame, frameRate);
numFFF = round2Ndecimals(mod(numFrame, numSecondFrame) * 1/frameRate, 3);
numSecond = mod((numFram... |
function [ indMorningStar ] = isMorningStar( obj,bars )
%%
% 《日本蜡烛图技术》,1998年5月第一版,P58
%% parameters
pierceRatio = 0.5;
%%
indStar = obj.isStar(bars);
indStar = indStar(2:end-1);
indYinYang = (bars.yinYang(1:end-2)==-1)&(bars.yinYang(3:end)==1);
indPierce = bars.barCeil(3:end)>bars.barFloor(1:end-2)+pierceRatio*bars.bar... |
function [ X, cost_val, step_size, iter_cnt, time_cost ] = my_grad_desc( cost_fun, X0, epsilon, alpha )
%Gradient descent with adaptive step size
% cost_fun - function handle, the cost function to minimize; 0 is the
% minimization target;
% X0 - initial guess;
% epsilon - error tolerance to stop the minimizatio... |
%BM3DDENOISING Performs image denoising using the Block-Matching and 3D-filtering algorithm
%
% dst = cv.bm3dDenoising(src)
% [dstStep1,dstStep2] = cv.bm3dDenoising(src)
% [...] = cv.bm3dDenoising(..., 'OptionName',optionValue, ...)
%
% ## Input
% * __src__ Input 8-bit or 16-bit 1-channel image.
%
% ## Output... |
function pimc(x,y,z,tn,cl)
%plot imagesc one way, with colorbar
imagesc(x,y,z);c = colorbar;colormap(jet);c.Label.String = cl;
if strcmpi(cl,'Win probability');c.Limits=[0 100];c.Ticks=[0 20 40 60 80 100];
elseif strcmpi(cl,'Error');c.Limits=[0 1];c.Ticks=[0 0.2 0.4 0.6 0.8 1];
elseif strcmpi(cl,'Suspense');title(tn);%... |
function dydt = sbp_proj(t, y, D1, u0_t_func)
dydt = -D1 * y;
dydt(1) = u0_t_func(t);
end |
clear all;
addpath('./others/');
%%------------------------set parameters---------------------%%
k = 100;%number of superpixels
k = num2str(k);
supdir=strcat('./superpixels',k,'/');% the superpixel label file path
imnames=dir([supdir '*.bmp']);
for ii=1:5
disp(ii);
imname=[supdir imnames(ii).name];
[inp... |
clear members
members=properties(gNLv);
idx=strmatch('all',members);
members(idx)=[];
for i=1:length(members)
if ( strcmp( class( gNLv.( members{ i } ) ) , 'Subject' ) && ~strcmp( members{ i } , 'all' ) )
gNLv.combine_subjects('name','all','exclusion',{'all',members{i}}... |
function penaltymat = exponpen(basisobj, Lfdobj)
%EXPONPEN computes the exponential penalty matrix for penalty LFD.
% Arguments:
% BASISOBJ ... a basis.fd object of type 'expon'
% LFDOBJ ... a linear differential operator to be penalized.
% Default is 2.
% Returns PENALTYMAT, the penalty matrix
% ... |
figure;
subplot(3,2,1), plot(Case4_RawObserve,'DisplayName','Case4_RawObserve');
xlabel('time');
ylabel('velocity value');
title('E4');
subplot(3,2,2), plot(Case7_RawObserve,'DisplayName','Case7_RawObserve');
xlabel('time');
ylabel('velocity value');
title('N1');
subplot(3,2,3), plot(Case5_RawObserve,'DisplayName','Cas... |
%% Load simulation data
load('grinder_position_true.mat');
load('grinder_position_detection.mat');
% figure(1);
% subplot(1,3,1);plot(x_true);hold on; plot(xx);hold on;
% subplot(1,3,2);plot(y_true);hold on; plot(yy);hold on;
% subplot(1,3,3);plot(z_true);hold on; plot(zz);hold on;
index = linspace(0,5,61);
%% Normal... |
cd([home '/Dropbox/Alzheimer/results/Descriptive/'])
save=0;
delta=1+(2:4);
theta=1+(5:7);
alpha=1+(8:13);
beta=1+(14:30);
close all
idx_control=subject_identifier(used_subjects==1)==0;
idx_patient=subject_identifier(used_subjects==1)==1;
fidx_control=find(subject_identifier(used_subjects==1)==0);
fidx_patient=find(sub... |
function isOnLine = pointOnLine(point, line)
%POINTONLINE Calculates whether point is located on line
% Each input is a matrix with 3 lines and 1 column
dimension_point = size(point);
dimension_line = size(line);
if dimension_point(1) == 3 && dimension_point(2) == 1 && ...
dimension_line(1) ... |
m = 10;
n0 = [20,50,100];
M0 = [1,5];
gamma0 = [1,10];
Table = [];
for iter1 = 1:3
n = n0(iter1);
for iter2 = 1:2
M = M0(iter2);
xstar = 120*(rand(n,1))-60;
sparsity = 0;
for t = 1:n
if xstar(t) > M || xstar(t) < -M || xstar(t)==0
xstar(t)... |
function dstatedt = Satellite(t,state)
%%%stateinitial = [x0;y0;z0;xdot0;ydot0;zdot0];
global BxI ByI BzI
x = state(1);
y = state(2);
z = state(3);
%xdot = state(4);
%ydot = state(5);
%zdot = state(6);
%%%inertia and mass
m = 2.6; %%kilograms
%%%Kinematics
vel = state(4:6);
%%%Gravity Model
planet
r = state(1:3); %... |
figure(8)
boxplot(Total);
xlabel('All Players')
ylabel('Total Points (points)')
title('Total points made by women volleyball player in FIVB 2020 (Preliminary Round)') |
%% Process both the qualtrics survey format and the survey itself to map survey data to
% the questions answered
clear
clc
strSurveyData = 'Similar_cluster_detection.csv';
strSurveyQuestions = 'Similar_cluster_detection.qsf';
[dataT, data] = ReadData( strSurveyData );
[dataTMap, ~] = ReadData( 'SurveyMapping.csv' );
... |
%% Declaration of Authoriship
% This code was written by Dirk DeVilliers and some portions were edited by Jason K. George
% for the purpose of his final year project at Stellenbosch University
% in partial completion for the subject Project (E) 448
%% Code
i = size(y);
k = i(1);
figure(250)
hold on
for i = 1:1
plo... |
function Success = SaveTaggedPlots(TagDescr, ResultsFolder, BaseFilename, Revision, FileExts, TagFontProperties)
% SaveTaggedPlots : Tag a plot in the lower left corner and save
% Detailed explanation goes here
Success = true;
ax1 = axes('Position',[0 0 1 1], 'Visible', 'off');
text(.01,0.01, TagDescr, TagFontPropert... |
data2Load =importdata([fileSave filesep 'data2Load.mat']);
%% Load data and run protocol her for every subjects
alogrith2Run;
GA_output(j,:) = output_subject;
%% Grand average work
if iFolder == nFolder
keyboard
%% Visualization
h = figure();
%% SavingProcess
if saveProcess
s... |
function [ outmixedcell ] = combinecondition(condAPrec,condACurr,condBPrec,condBCurr,seqcondcell )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
outmixedcell=[seqcondcell{condBPrec,condBCurr};seqcondcell{condAPrec,condACurr}];
end
|
r_width=16;
g_width=4;
g_width2=5;
b_width=8;
x0=16; %make smaller to move yellow closer to red
% yellow='y';
yellow='n'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x=64:-1:1;
%
r=.3*exp(-x/r_width)+.7;
%
if yellow=='y'
g=.7*(1-exp(-x/g_width))+.3*exp((-(x-x0).^2)/(2*g_width2^2));
else
g=.7*(1-exp(-x/g_width... |
function v = newtonVect(f, f1, x0, e)
g = @(x) x - (f(x)/f1(x));
c = x0;
v = [c];
while (abs(f(c)) > e)
c = g(c);
v = [v c];
end
end
|
function [out_arg] = EvaluationSum(x)
% This function gets a vector of points and
% calculates the fitness value (Sum of different power test function).
% Input:
% x: A vector containing the values of the variables
%
% Output:
% out_arg: The fitness value of the input vector
% ... |
% The overarching folders containing the group folders which in turn contain
% the sorted data as generated by SYNC_CURATED_DATA and the preprocessed
% multiunit and LFP data as generated by PREPROCESS_MULTIUNIT.
% e.g.
% EXPERIMENTAL_GROUP/EXPERIMENTAL_PREPS/EXPERIMENT_TITLES/EXPERIMENT_FILES.MAT
sorted_folder ... |
% Based on code by Karel Mertens for solving RBC models
clear all;
close all;
% Parameter values
mu = 0.34;
beta = 0.99;
alpha = 1.0;
gamma = -1.0;
theta = 0.36;
v = 3.0;
sigma = 0.01;
delta = 0.025;
J = 4;
A = [.906 .088; .088 .906];
rho = sum(A(1,:));
yss = 1; % Output is normalized to 1
zs... |
%% Stelling 11
%
% De functie ones() kan een vector opleveren bestaande
% uit 1 element op.
%
Antwoord = NaN; % vul hier het juiste antwoord in 1 (WAAR) of 0 (ONWAAR)
|
global epsZero;
global print_error;
epsZero = 1000*eps;
print_error = true;
r = 1;
G = @(x,y) 0.2*x.^2+y.^2-r^2
dGx = @(x,y) 0.4*x
dGy = @(x,y) 2*y
stepwidth = 10^-2
phi = 0
x0 = 0
y0 = 1
h = 10^-1
hold on
plottinator = @(a,b) plot(a,b,'r');
[x y] = implicitCurve_ortho(G, dGx, dGy, x0, y0, 105, h, pl... |
# Introdução do trabalho
clc
disp ('--------------------------------------------------');
disp ('Primeiro trabalho de Algoritmos Numéricos');
disp ('Profª Andrea Valli');
disp ('Desenvolvido por Gabriel Pietroluongo');
disp ('--------------------------------------------------');
disp (' ');
disp ('Objetivos:');
disp (... |
vi = 2.9;
thetaLO = 14.16;
thetaSO = 31.9;
target = 1.10;
if (length(target) == 1)
thetaL = compute_launch_angle(target, vi);
thetaS = compute_servo_angle(thetaL, thetaLO, thetaSO);
fprintf('Target distance: %3.2f m \nLaunch angle: %3.2f degrees \nServo angle: %3.2f\n', target, thetaL, thetaS);
else
the... |
function [alpha_rudder_neu] = rudderUpdate(alpha_rudder_des, alpha_rudder, delta_t, maxSpeed)
delta_r = abs(alpha_rudder_des-alpha_rudder);
if delta_r > (maxSpeed*delta_t)
delta_r = maxSpeed*delta_t;
end
if alpha_rudder_des > alpha_rudder
alpha_rudder_neu = alpha_rudder + delta_r;%*delta_t;
else
alpha_ru... |
% WPTHCOEF ウェーブレットパケット係数のスレッシュホールド操作
%
% NEWT = WPTHCOEF(T,KEEPAPP,SORH,THR) は、係数のスレッシュホールド操作による
% ウェーブレットパケットツリー T から得られる、新しいウェーブレット
% パケットツリー NEWT を出力します。
%
% KEEPAPP = 1 の場合、approximation 係数にはスレッシュホールドは適用されません。
% その他の場合は、適用される可能性があります。
% SORH = 's' の場合、ソフトスレッシュホールドが適用されます。
% SORH = 'h' の場合、ハードスレッシュホールドが適用されます ... |
function a = softmax(z)
temp = exp(z(1,:)) + exp(z(2,:));
a(1,:) = exp(z(1,:)) ./ temp;
a(2,:) = exp(z(2,:)) ./ temp;
end |
%曾鈺皓_0071035_Matlab簡介_作業5
clear;clc;clf;
%(A)以 randi 函數產生 100 個雨滴粒半徑(r),其值在 1~100(微米)區間,
%並以 fprintf()指令分別顯示雨滴粒半徑、雨滴終端速度、及雨滴體積的最小值和最大值
a=randi([1,100],[1,100]); %1到100「微米」
vt1=(9.8*(a*10^-6).^2*(997-1.204))/18/(1.81*10^-5); %終端速度
v=4*pi*((a*10^-6).^3)/3; %體積
fprintf('雨滴半徑最小值:%g \n雨滴半徑最大值:%g \n',min(a),max(a))
fprintf(... |
function Z = mass_lista_fprop( X, We, S, theta, T )
%LISTA_FPROP Summary of this function goes here
% [ Z0, Z, C, B ] = lista_fprop( X, We, S, theta, T )
% Detailed explanation goes here
B=We*X;
Z=h_theta(B,theta);
for t=1:T
Z=h_theta(B+S*Z,theta);
end
end |
function traj = init(baseSize, resolution)
numPoints = baseSize/resolution;
traj = zeros(numPoints,2);
for k=1:1:(numPoints+1)
traj(k,:) = [0 (-0.5*baseSize)+((k-1)*resolution)];
end
end |
function y = convertToImg(x,Ng,Mg)
[N M] = size(x);
if(M==1) % If it's a vector
y = reshape(x, Mg, Ng);
y = y';
else
y = x;
end
|
function [BER_qpsk,BER_qpsk_t]=Fade_SNR_qpsk_plot(SNR)
%%%%%初始参数设置%%%% %%%%%
N_packet = 1e6;
N_bits = 1e2;
N_symbol_qpsk=N_bits/2;
%SNR = 0:5:40;
SNRR = 10.^(SNR./10);
SNR_len=length(SNR);
Data_bit = round(rand(N_bits,SNR_len));
BER_qpsk_index = zeros(SNR_len,N_packet);
%%%%%QPSK调制%%%%%%%%%%%%%%%%%
Data_qpsk = qpsk_mod... |
img_name = '/media/alex/5FC39EAD5A6AA312/Micron_imaging/Reconstruction_ferrets/Naja/Converted/Meta/img_final_xyz.mat';
downsmaple_f = 10;
ij.IJ.run("Quit",""); %Close ImageJ
load(img_name);
temp_img = double(img_final_xyz);
temp_img = (temp_img./max(temp_img(:)))*255;
F = griddedInterpolant(temp_img);
[sx,sy,sz] = size... |
% contour_create( filename, size_x, size_y, image_filename )
%
% filename: output filename for created data
% size_x: width of the drawing window
% size_y: height of the drawing window
% image_filename: an image visualized in the background
% which can be used to guide your drawin... |
function [X,Y,idx] = convolutionHelper(res,thresh,kernel,epsilon,minPoints)
s = size(res);
id = res>thresh;
X = zeros(nnz(id),3);
count = 0;
sInput = size(kernel);
% if nnz(id) > 20000
% Y = [0,0];
% idx = [0];
% X = [0,0,0];
% fprintf('Skipping convolution due to... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% gain_oracle_multibeam_sim.m
% Author: Ish Jain
% Date Created: Dec 1 2020
% Description: In this script, we randomly vary the wireless channel
% characteristics and compute the SNR gain of multi-beam over a single-beam
% solution. We also comp... |
%adg_run1 run single problem
function adg_run1
pdat_set = mcute_org2pdat('adg_set.org');
slv_opt = arcopt_nm_lc.optset();
% io options
io_opt = solve_pdat();
io_opt.print_flag = 1;
%keyboard
slv = solve_pdat(pdat_set(1),slv_opt,io_opt)
end |
addpath('../')
region = fetchregion([34.095305, 34.109537], [-118.214006, -118.207687], ...
'display', true);
elevData = region.readelevation([34.095305, 34.109537], ...
[-118.214006, -118.207687], 'display', true);
dispelev(elevData, 'mode', 'cartesian'); |
function out=mrfilter(indata, s)
%
% function out = mrfilter( 3D_image, pixel_sizes)
%
% This filter prodices a Gaussian weighted sum of the neighbors
% this weighted sum is weighted ALSO by a spatial derivative of time images
% The result is a Gaussian smoothing kernel that PRESERVES THE EDGES a
% little better
%
i... |
%A=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20;
% 0.87 0.49 0.36 0.83 0.87 0.49 0.36 0.83 0.87 0.49 0.36 0.83 0.87 0.49 0.36 0.83 0.87 0.49 0.36 0.83 ];
% A=[1 2 3 4 5 6 7 8;
% 0.87 0.49 0.36 0.83 0.87 0.49 0.36 0.83];
input = xlsread('Input.xlsx','sheet3','B2:N32');
%输入数据以上
for day=1:31
[A,n]=p... |
clear;
us_pop = csvread('./data/us_1990_2015.csv',1,0);
pop_years = us_pop(:,1);
totals = us_pop(:,2);
us_tub = csvread('./data/us_1953_2015_tb_incidence.csv',1,0);
years = fliplr(us_tub(:, 1));
incidence = fliplr(us_tub(:, 2));
inc_rate = fliplr(us_tub(:, 3));
smooth_inc = smooth(incidence);
plotNo = 1;
figure; hol... |
%ABSTRACT
% Library function for SDCM.
% - Computes the uncentered, possibly weighted correlations between num2cell(V1s,corrDim) and num2cell(V2s,corrDim) elements.
% - all vectors listed in batchDim=iif(corrDim==2,1,2) are processed separately
% - R will be of size size(V1s,batchDim)*size(V2s,batchDim); DOFs and... |
function check_symmetry(A,s,tol)
% check_sym(A,s,tol)
err_A=norm(A-A','fro');
big_A=norm(A,'fro');
tol_A=big_A*length(A)*tol;
if err_A > tol_A,
fprintf('max nonsymmetry %g > tolerance %g\n',err_A,tol_A);
error([s,' must be symmetric']);
end
end
|
function [estx, inlier_idx, outlier_idx, errs, avgerr] = ...
lmeds(data, options, condfunc, varargin)
%LMEDS is a framework for parameter estimation using the LMedS method.
%
% [estx,...] = ...
% lmeds(data,options,condfunc,varargin)
% [estx,inlier_idx,outlier_idx,errs,avgerr] = ...
% lm... |
function ret = pcz_matrix2latex_1(varargin)
%%
%
% file: pcz_matrix2latex_1.m
% author: Polcz Péter <ppolcz@gmail.com>
%
% Created on Fri Feb 20 23:23:07 CET 2015
%
%%
% fname: full path of the actual file
eval(pcz_cmd_fname('fname'));
persist = pdirs(fname);
out_file = [ persist.tmp '/' persist.file.bname '.ou... |
function fc_delete(forest_collection)
% fc_delete(forest_collection)
% Deallocate a collection of random forests
num_forests = length(forest_collection.forests);
for i=1:num_forests,
rf_delete(forest_collection.forests{i});
end
end
|
# Filtros IIR / Filtros Recursivos
# É um filtro de um único polo, semelhante a um circuito RC.
# Características:
# - possui, no máximo, 3 coeficientes fáceis de se calcular;
# - são versões digitais de circuitos RC;
# - possui boa resposta no tempo, mas é fraco na resposta em frequência;
# - pode ser montado na for... |
% Zmienne:
% x(1) cena
% x(2) wolumen
% x(3) jakoosc
% x(4) reklama internet
% x(5) reklama magazyny
% x(6) reklama tv
% x(7) kredyt brany w danej rundzie
% x(8) JKZ
% PRZEKAZANE Z JAVY:
% 9 gotowka, dostepna na poczatek
% 10 nrEtapu
% 11 pobrany kredyt we wczesniejszych rundach
function [fval] = ryzy... |
function produceFigures(handles, outputpath,outputFormat, thresholdMethod, noProjectionTest, exportFigures)
if nargin==4
noProjectionTest=false;
exportFigures=true;
end
colors={'r','g','b','k','y','m','c','r','g','b','k','y','m','c','r','g','b','k','y','m','c'};
paperPosition=[0 0 16 12];
figure(123);
... |
%This script plots the mean growth as a function of volume
clear;clc
load('large_volume_sweep.mat')
max_growth = 25*100/(1+1);
max_perm_growth = 25*100/3;
colors = [0 0 0;...
230 159 0;...
86 180 233;...
0 158 115; ...
240 228 66;...
213 94 0;...
204 121 167]/255;
fontsize = 4;
linewidth = ... |
%{
psy.Movie (manual) # movie stimulus
-> psy.Condition
-----
clip_number : int # index of clips, used in filename
path_template = '~/stimuli/movies/madmax/madmax_%03u' : varchar(255) #
cut_after : float # (s) cuts off after this duration
%}
classdef Movie < dj.Relvar
end |
function [ reflection_x,reflection_y,reflection_z ] = getReflections( surface,surface_normal,incident_direction,x1,x2,y1,y2,h, t )
%--------------------------PURPOSE-----------------------------------------
%gets the reflected values
%--------------------------INPUTS------------------------------------------
%surfa... |
%TEST_getTraj_ds.m
%
% This script tests the trajectory optimization code for double stance, but
% find a trajectory that simply moves the hip forward by some distance
clear; clc;
%%%% Parameters for Dynamics %%%%
config.dyn.g = 9.81; % acceleration due to gravity
config.dyn.l = 0.96; % leg length (hip joint to foot j... |
clc;
close all;
clear;
workspace;
format long g;
format compact;
fontSize = 20;
grayImage = imread('Truck.bmp');
[rows columns] = size(grayImage);
subplot(2, 2, 1);
imshow(grayImage, []);
title('Original Gray Scale Image', 'FontSize', fontSize);
set(gcf, 'Position', get(0,'Screensize'));
noisyImage ... |
%{
układ dynamiczny romeo&juliet
----(-5)----(-2.5)----(0)----(2.5)----(5)----> skala uczuć od negatywnych do ❤❤❤❤
dx/dt=-0.2y
dy/dt=0.8x
x(0)=2 poziom uczuć romea początkowy
y(0)=0 poziom julii początkowy
rozwiązanie:
x(t)=2cos(0.4t)
y(t)=4sin(0.4t)
%}
clc;
clear;
[T, Y] = ode45(@love, [0,20], [2,0]);
... |
function [stiffener_cords,XY_stiffener] = VAT_stiffener_rigid_rotational(T01,a,b,stiffener_nodes_number,RigidTheta)
number_of_nodes = 10001;
x_RHS = linspace(0,a/2,number_of_nodes );
T0 = T01(1)/180*pi;
T1 = T01(2)/180*pi;
if T0 == T1
T1 = T1+1e-2/180*pi;
end
% RHS w.r.t x'
y_RHS = a/2/(T1-T0).*(-lo... |
function [ArgStructOut, ParamsSet] = THargparse(argin, defaults)
% THARGPARSE parses input arguments in Tyler Hennen fashion
% Parses arguments in a simple way that does not require values
% for each parameter, assuming a value of true by default.
% Argument values cannot be strings, all parameter names will
% be conv... |
function [c1,s1] = Im2ReducedC1LapGS(stim);
%function out = Im2ReducedC1LapGS(stim);
%
% stim should be grayscale image and between 0 and 1
% set up filters
if(isinteger(stim))
stim = im2double(stim);
end
sqfilter{1} = [1,1,1;0,0,0;-1,-1,-1];
sqfilter{2} = [-1,0,1;-1,0,1;-1,0,1];
sqfilter{3} = [0,1,1;-1,0,1;-1,-1,0... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Code to run part-based RCNNs for fine-grained detection %
%%%% Usage: put pretrained deep model paths into cnn_models %%
%%%% Also define model definition file %%%%%%%%%%%%%%%%%%%%%%%
%%%% Change all the paths to your path %%%%%%%%%%%%%%%%%%%%%%%
%%%% ... |
clear,clc
input_path='../../input/';
%input parameters
z_o=0.1;
N_turnovers=25;
Nx=36;
Ny=36;
Nz=36;
hprocs=2;
l_r=1;
z_i=1000;
u_star=0.45;
l_z=1000;
press_cor=0;
f_p=u_star^2/l_z;
mom_nodes=0;
verticalBC=0;
nu=0;
theta_mean_wind=0;
cs_count=2;
nframe=0;
c_flag=0;
scalarcount=0;
npart=100000;
part_model=2;
r... |
%% Stelling 24
%
% Het uitvoeren van onderstaande code in Matlab
% gaat foutloos:
%
% ------------code--------------
% naam1 = "tekst"
% naam2 = 'tekst'
% selectie = na... |
close all
clear all
clc
% read data
data = readData();
% constants
fractions = 0.1:0.01:0.90;
repetitions = 100;
lambdas = 0:0.1:10;
% input
X = [ones(size(data,1),1) data(:,1:end-1)];
N = size(X,1);
% ouput
Y = data(:,end);
trainErrors = zeros(length(fractions),length(lambdas));
testErrors = zeros(length(fractions),l... |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Function: robust_save
% Version: 0.02
% Date: 13.11.2017
% Author: Rob Eccleston
% Description: Tries to write a file until it is successful. Will try 100
% times, with a 1 second pause in between attempts then just continue
% without ... |
function [ bary_coord ] = cart2bary( cart_coord, TR )
%CART2BARY Convert cartesian coordinate to barycentric coordinate
% cart_coord = cartesian coordinate in 2D (nx2 vector of n points)
% TR = Triangular points forming a triangle (3x2 vector of the vertices)
% check TR is 3x2
% check cart_coord is nx2
% convert... |
function [opti_lag, line, max_c] = wavecorr(x,y,varargin)
% Wrapper around xcorr. Do cross correlation of x and y and plot it to current axes.
% Optional arguments:
% - f: sampling frequency in hz of x and y to correctly display max
% lag. Defaults to 1 [hz].
% - max_shift: how... |
function [pfn npf cx0 cxi0 cx12 obuf pwu]= ...
resetblock(pfn,npf,cx0,cxi0,cx12,obuf,prn,pwu)
%
% Function resetblock
% ===================
%
% This function resets the following controls (for a given prn):
%
% - Observation buffer
% - Pseudorange smoothing filter
% - A... |
function This = plus(This,K)
% plus Create time-recursive lead of tseries object.
%
% Syntax
% =======
%
% X{T+K}
%
% Input arguments
% ================
%
% * `X` [ tseries ] - Tseries object whose time-recursive lead will be
% created.
%
% * `T` [ trec ] - Initialized trec object.
%
% * `K` [ numeric ] - Integer ... |
function data = InterpGaugeResult( obj, fphys )
Nfield = size( fphys{1}, 3 );
data = zeros( obj.Ng, Nfield );
for n = 1 : obj.Ng
meshId = obj.gaugeMesh(n);
cellId = obj.gaugeCell(n);
Vg = obj.Vg{n};
for fld = 1:Nfield
data(n, fld) = Vg * fphys{meshId}(:, cellId, fld);
end
end
end |
% This script makes a movie to show the fields between start_diagnose
% and end_diagnose in its directory
% Copy this script to the folder of the data and then run it
clear; close all;
global den Te vi jz ve phi vEx vEy vdex vdey dt inv_nustar
load('parameters.mat');
addpath(code_path);
last_file = get_last_file... |
function feat=Texture(imagename)
img=imread(imagename);
feat=[];
glcm=graycomatrix(img,'Offset',[0 1]);
stats=graycoprops(glcm,'Contrast');
feat(1)=stats.Contrast;
stats=graycoprops(glcm,'Correlation');
feat(2)=stats.Correlation;
stats=graycoprops(glcm,'Homogeneity');
feat(3)=stats.Homogeneity;
stats=graycoprops(glcm,'... |
%% Name: Sheel Nidhan
% To calculate the Reynolds stresses and its similarity in the 'non-equilibrium' region
clear; clc; close all;
%% Parameters
loc_planes = [20; 25; 30; 35; 40; 45; 50; 55];
nstart = 1892600;
nend = 2613200;
stride = 100;
dir_in_planes = '/home/sheel/Work2/projects_data/spod_re5e4/frinf/reystre... |
function [m] = splitm(p)
d=mat2cell((stretchAudio(p',2))',[2],[19453 387]);
m=d{1,1};
end
|
%% Stelling 7
%
% Een functie moet altijd 1 input variabele hebben.
%
Antwoord = 0;
|
%% Export alpha-shapes
%%
%% Input:
%% NO.1 para. = the dataset
%% NO.2 para. = the activation for this function
function export_alpha_shape(data, act)
if (act == 1) % Activation
% Initialise
start_frame = 1;
last_frame = length(data);
for num = start_frame: last_frame - 1
... |
clear all; close all; clc;
% Make current path, path of this file
apThisFile = fileparts(mfilename('fullpath'));
cd(apThisFile);
% Copy example
nmFileSrc = 'example.m';
nmFileDes = 'copy.m';
copyfile(nmFileSrc,nmFileDes);
apDes = fullfile(apThisFile,nmFileDes);
tic
removeCommentsAndEmptyLines(apDes);
t... |
%
% RSEncoder
% Function to Encode a list of integers in 0..255 using
% Reed-Solomon with parameter n,k
%
% Input
% n : length of the codeword
% k : dimension of the message
% comeMsg : list that rappresent the message
%
% Output
% EncodeMsg ; encoded message of length n
function encodedMsg = RSEncoder(n,k,... |
function TF = isa75(filename)
%ISANALYZE75 Return true for a header file of a Mayo Analyze 7.5 data set.
%
% TF = ISANALYZE75(FILENAME) returns TRUE if FILENAME is a header file of
% a Mayo Analyze 7.5 data set.
%
% FILENAME is considered to be a valid header file of a Mayo Analyze 7.5
% data set if the header... |
function result=bucketsort_truncate(array,N)
buffer=zeros(length(array),1);
buckets=zeros(1+10^N,1);
array=floor(array*10^N)+1;
for i=1:length(array)
x=array(i);
if buckets(x)==0
buckets(x)=i;
else
buffer(i)=buckets(x);
buckets(x)=i;
end
end
z=0;
result=zeros(length(array),1)... |
%% Constants across all experiments
clear all
close all
clc
N = 38; % Number of agents
r = 1:38; % Range
suffix = '.csv'; % csv suffix (all files in this format)
%% Baseline and all-agent data
allagent = -load('allagent.csv');
baseline = -load('baseline.csv');
figure(1)
hold on
plot(allagen... |
function [d, cost] = primal_solve(node, rho)
d_best = [-1,-1]';
cost_best = 1000000; %large number
sol_unconstrained = 1;
sol_boundary_linear = 1;
sol_boundary_0 = 1;
sol_boundary_100 = 1;
sol_linear_0 = 1;
sol_linear_100 = 1;
if(node.index == 1)
index = 1;
... |
function result = folderNameCount(input_string, folder_name)
% count ubm files alread present
files = dir(folder_name);
all_files = files(~[files(:).isdir]);
num_files = numel(all_files);
tags = cell(num_files,1);
for k=1:num_files
tags{k} = all_files(k).name;
end
result = cellfun(@(S) strfind(S,input_string), tag... |
function [evec,om] = adjointMode(A,B,shift_om,nval,startvec)
%
% Solve A'*w = +i*om*B'*w, for om near shift_om
%
% Input shift_om should be close to conj. of direct eigval of interest
%
if ~issparse(A)
A=sparse(A);
end
if ~issparse(B)
B=sparse(B);
end
shift = +1i*shift_om;
OP = A'-shift*B';
[L,U,p,q] = lu(O... |
function temporal_profile_save_csv_plot(profile_data, save_dir)
if nargin < 2
save_dir = '.';
end
segment_event = profile_data.segment_event;
var_name = profile_data.variable_name;
if iscell(var_name)
example_var_name = var_name{1};
is_var_cell = true;
num_vars = length(var_name);
else
example_va... |
addpath ~/jsrc/jacket/engine/
addpath ~/jsrc/jacket/test/harness
clear all
close all
% settings
iter = 100;
colr = 1;
norm = 0;
% sobel
h0 = [-2.0, -1.0, 0.0;
-1.0, 0.0, 1.0;
0.0, 1.0, 2.0];
% robinson
h1 = [ 0.0, 1.0, 1.0;
-1.0, 0.0, 1.0;
-1.0, -1.0, 0.0];
% gauss... |
% 生产渐变彩条
function img_out = gen_img_colorbar_1(height, width);
img_r=[];
img_g=[];
img_b=[];
for i = 1:(width/255+1)
[r,g,b] = gen_color_bar_1(i);
img_r = [img_r,r];
img_g = [img_g,g];
img_b = [img_b,b];
end
img_r = img_r/255;
img_g = img_g/255;
img_b = img_b/255;
for i = 1:height
k=1;
for j... |
%% dvbt_receive_init Close all dump files.
%%
%% dvbt_receive_init() initializes state of DVB-T reciever
%% in global DVBT_STATE_RECEIVER to defined values.
%% This function can also be used to reset the receiver.
%% It has to be called after global_settings.
function dvbt_receive_init ()
global DVBT_SETTI... |
function [ field2d ] = VerticalColumnIntegralField( obj, field3d )
%VERTICALINTEGRALFIELD Summary of this function goes here
% Detailed explanation goes here
% Np2 = obj.mesh2d.cell.Np;
% K2d = obj.mesh2d.K;
%
% fmod = obj.cell.V \ (obj.Jz .* field3d);
%
% field2d = zeros( Np2, K2d );
%
% sk = ( (1:K2d) - 1 ) * o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.