Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

swh:1:snp:a568cc5cff39965992895669038ed8c43a59eedd
  • Code
  • Branches (1)
  • Releases (0)
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    No releases to show
  • bbb89f8
  • /
  • Figure 2 -- Known Reward Thresholds
  • /
  • Figure 2S1 -- Evidence Quality Impacts Belief
  • /
  • Figure_2S1_Generate.m
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
content badge Iframe embedding
swh:1:cnt:b2ba9cfb5a94023904766f7ff171b9f69fd79a2a
directory badge Iframe embedding
swh:1:dir:3fb4c98d75327d03553e05ba13aae853ed61cdf9
revision badge
swh:1:rev:2878a3d9f5a3b9b89a0084a897bef3414e9de4a2
snapshot badge
swh:1:snp:a568cc5cff39965992895669038ed8c43a59eedd

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 2878a3d9f5a3b9b89a0084a897bef3414e9de4a2 authored by nwbarendregt on 03 May 2022, 15:08:29 UTC
Add files via upload
Tip revision: 2878a3d
Figure_2S1_Generate.m
% Figure_2_Generate.m
% Script used to generate Figure 2 -- Supplemental Figure 1 from 
% Barendregt et al., 2022.

% Define plotting domain and Gaussian generating function:
x = linspace(-10,10,1000);
f = @(x,mu,sigma) exp(-0.5*((x-mu)/sigma).^2)/(sigma*sqrt(2*pi));

% Plot low evidence quality distributions (Fig. 2 -- Supplement 1 A):
mu = 1; sigma = 1;
figure
plot(x,f(x,mu,sigma),'b','linewidth',15)
hold on
plot(x,f(x,-mu,sigma),'r','linewidth',15)
plot([0 0],[0 0.4],'k--','linewidth',5)

% Define simulation parameters for belief trajectories:
T = 1; dt = 0.005; N_trial = 5;

% Calculate scaled SNR m:
m = 2*mu^2/(sigma^2);

% Generate belief trajectories:
y = RDMD_trial_generate(2,T,dt,0,N_trial);

% Plot low evidence quality belief trajectories (Fig. 2 -- Supplement 1 B):
figure
plot(0:dt:T,y,'linewidth',5)
hold on
plot([0 T],[0 0],'k--','linewidth',5)

% Plot high evidence quality distributions (Fig. 2 -- Supplement 1 C):
mu = 5; sigma = 1;
figure
plot(x,f(x,mu,sigma),'b','linewidth',15)
hold on
plot(x,f(x,-mu,sigma),'r','linewidth',15)
plot([0 0],[0 0.4],'k--','linewidth',5)

% Generate and plot high evidence quality belief 
% trajectories (Fig. 2 -- Supplement 1 B):
m = 2*mu^2/(sigma^2);
y = RDMD_trial_generate(2,T,dt,0,N_trial);

figure
plot(0:dt:T,y,'linewidth',5)
hold on
plot([0 T],[0 0],'k--','linewidth',5)

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API