diff --git a/blitherboom-blog/.dockerignore b/blitherboom-blog/.dockerignore new file mode 100644 index 00000000..f06235c4 --- /dev/null +++ b/blitherboom-blog/.dockerignore @@ -0,0 +1,2 @@ +node_modules +dist diff --git a/blitherboom-blog/.editorconfig b/blitherboom-blog/.editorconfig new file mode 100644 index 00000000..9d08a1a8 --- /dev/null +++ b/blitherboom-blog/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/blitherboom-blog/.github/workflows/gh-pages.yml b/blitherboom-blog/.github/workflows/gh-pages.yml new file mode 100644 index 00000000..28078245 --- /dev/null +++ b/blitherboom-blog/.github/workflows/gh-pages.yml @@ -0,0 +1,42 @@ +name: GitHub Pages + +on: + push: + branches: + # The branch where the project source code resides + # 项目源代码所在的分支 + - main + - master + - valaxy + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + node-version: [lts/*] + os: [ubuntu-latest] + fail-fast: false + + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + registry-url: https://registry.npmjs.org/ + + - name: 📦 Install Dependencies + run: npm i + + - name: 🌌 Build Valaxy Blog + run: npm run build + + - name: 🪤 Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist + force_orphan: true diff --git a/blitherboom-blog/.gitignore b/blitherboom-blog/.gitignore new file mode 100644 index 00000000..6d06d3fb --- /dev/null +++ b/blitherboom-blog/.gitignore @@ -0,0 +1,20 @@ +# valaxy + +valaxy-fuse-list.json + +# vite-ssg + +.vite-ssg-dist +.vite-ssg-temp + +temp/ + +.DS_Store +*.local +dist +dist-ssr +node_modules +.idea/ +*.log + +components.d.ts diff --git a/blitherboom-blog/.npmrc b/blitherboom-blog/.npmrc new file mode 100644 index 00000000..71ecd69c --- /dev/null +++ b/blitherboom-blog/.npmrc @@ -0,0 +1,3 @@ +# for pnpm +shamefully-hoist=true +strict-peer-dependencies=false diff --git a/blitherboom-blog/.valaxy/typed-router.d.ts b/blitherboom-blog/.valaxy/typed-router.d.ts new file mode 100644 index 00000000..ffe6dc2b --- /dev/null +++ b/blitherboom-blog/.valaxy/typed-router.d.ts @@ -0,0 +1,56 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// Generated by unplugin-vue-router. ‼️ DO NOT MODIFY THIS FILE ‼️ +// It's recommended to commit this file. +// Make sure to add this file to your tsconfig.json file as an "includes" or "files" entry. + +declare module 'vue-router/auto-routes' { + import type { + RouteRecordInfo, + ParamValue, + ParamValueOneOrMore, + ParamValueZeroOrMore, + ParamValueZeroOrOne, + } from 'unplugin-vue-router/types' + + /** + * Route name map generated by unplugin-vue-router + */ + export interface RouteNamedMap { + '/': RouteRecordInfo<'/', '/', Record, Record>, + '/[...path]': RouteRecordInfo<'/[...path]', '/:path(.*)', { path: ParamValue }, { path: ParamValue }>, + '/404': RouteRecordInfo<'/404', '/404', Record, Record>, + '/about/': RouteRecordInfo<'/about/', '/about', Record, Record>, + '/about/site': RouteRecordInfo<'/about/site', '/about/site', Record, Record>, + '/archives/': RouteRecordInfo<'/archives/', '/archives', Record, Record>, + '/categories/': RouteRecordInfo<'/categories/', '/categories', Record, Record>, + '/links/': RouteRecordInfo<'/links/', '/links', Record, Record>, + '/page/[page]': RouteRecordInfo<'/page/[page]', '/page/:page', { page: ParamValue }, { page: ParamValue }>, + '/posts/量筒': RouteRecordInfo<'/posts/量筒', '/posts/量筒', Record, Record>, + '/posts/数逻': RouteRecordInfo<'/posts/数逻', '/posts/数逻', Record, Record>, + '/posts/数字系统设计': RouteRecordInfo<'/posts/数字系统设计', '/posts/数字系统设计', Record, Record>, + '/posts/通网': RouteRecordInfo<'/posts/通网', '/posts/通网', Record, Record>, + '/posts/AI': RouteRecordInfo<'/posts/AI', '/posts/AI', Record, Record>, + '/posts/Antenna': RouteRecordInfo<'/posts/Antenna', '/posts/Antenna', Record, Record>, + '/posts/Computer-Network': RouteRecordInfo<'/posts/Computer-Network', '/posts/Computer-Network', Record, Record>, + '/posts/cpp-multi-file': RouteRecordInfo<'/posts/cpp-multi-file', '/posts/cpp-multi-file', Record, Record>, + '/posts/CSAPP学习笔记': RouteRecordInfo<'/posts/CSAPP学习笔记', '/posts/CSAPP学习笔记', Record, Record>, + '/posts/DataAndAlgorithms': RouteRecordInfo<'/posts/DataAndAlgorithms', '/posts/DataAndAlgorithms', Record, Record>, + '/posts/Digital-Signal-Processing': RouteRecordInfo<'/posts/Digital-Signal-Processing', '/posts/Digital-Signal-Processing', Record, Record>, + '/posts/DRL': RouteRecordInfo<'/posts/DRL', '/posts/DRL', Record, Record>, + '/posts/github-command': RouteRecordInfo<'/posts/github-command', '/posts/github-command', Record, Record>, + '/posts/hello-valaxy': RouteRecordInfo<'/posts/hello-valaxy', '/posts/hello-valaxy', Record, Record>, + '/posts/hello-world': RouteRecordInfo<'/posts/hello-world', '/posts/hello-world', Record, Record>, + '/posts/Introduction-to-Probability': RouteRecordInfo<'/posts/Introduction-to-Probability', '/posts/Introduction-to-Probability', Record, Record>, + '/posts/Physics': RouteRecordInfo<'/posts/Physics', '/posts/Physics', Record, Record>, + '/posts/PhysicsExercise': RouteRecordInfo<'/posts/PhysicsExercise', '/posts/PhysicsExercise', Record, Record>, + '/posts/Python-OJ': RouteRecordInfo<'/posts/Python-OJ', '/posts/Python-OJ', Record, Record>, + '/posts/Signal-and-Systems': RouteRecordInfo<'/posts/Signal-and-Systems', '/posts/Signal-and-Systems', Record, Record>, + '/posts/Speech-SP': RouteRecordInfo<'/posts/Speech-SP', '/posts/Speech-SP', Record, Record>, + '/posts/StaSP': RouteRecordInfo<'/posts/StaSP', '/posts/StaSP', Record, Record>, + '/posts/Stochastic-Process': RouteRecordInfo<'/posts/Stochastic-Process', '/posts/Stochastic-Process', Record, Record>, + '/posts/stuffs': RouteRecordInfo<'/posts/stuffs', '/posts/stuffs', Record, Record>, + '/tags/': RouteRecordInfo<'/tags/', '/tags', Record, Record>, + } +} diff --git a/blitherboom-blog/Dockerfile b/blitherboom-blog/Dockerfile new file mode 100644 index 00000000..4b725b98 --- /dev/null +++ b/blitherboom-blog/Dockerfile @@ -0,0 +1,18 @@ +FROM node:16-alpine as build-stage + +WORKDIR /app +RUN corepack enable + +COPY .npmrc package.json ./ +RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \ + pnpm install + +COPY . . +RUN pnpm build + +FROM nginx:stable-alpine as production-stage + +COPY --from=build-stage /app/dist /usr/share/nginx/html +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/blitherboom-blog/README.md b/blitherboom-blog/README.md new file mode 100644 index 00000000..7952fa14 --- /dev/null +++ b/blitherboom-blog/README.md @@ -0,0 +1,51 @@ +# create-valaxy + +Example: [valaxy.site](https://valaxy.site) + +## Usage + +```bash +# install +npm i +# or pnpm i + +# start +npm run dev +# or pnpm dev +``` + +See `http://localhost:4859/`, have fun! + +### Config + +Modify `valaxy.config.ts` to custom your blog. + +English & Chinese Docs is coming! + +> Wait a minute. + +### Docker + +```bash +docker build . -t your-valaxy-blog-name:latest +``` + +## Structure + +In most cases, you only need to work in the `pages` folder. + +### Main folders + +- `pages`: your all pages + - `posts`: write your posts here, will be counted as posts +- `styles`: override theme styles, `index.scss`/`vars.csss`/`index.css` will be loaded automatically +- `components`: custom your vue components (will be loaded automatically) +- `layouts`: custom layouts (use it by `layout: xxx` in md) +- `locales`: custom i18n + +### Other + +- `.vscode`: recommend some useful plugins & settings, you can preview icon/i18n/class... +- `.github`: GitHub Actions to auto build & deploy to GitHub Pages +- `netlify.toml`: for [netlify](https://www.netlify.com/) +- `vercel.json`: for [vercel](https://vercel.com/) diff --git a/blitherboom-blog/components/README.md b/blitherboom-blog/components/README.md new file mode 100644 index 00000000..cbd3a140 --- /dev/null +++ b/blitherboom-blog/components/README.md @@ -0,0 +1,7 @@ +# Components + +Components in this dir will be auto-registered and on-demand, powered by [`unplugin-vue-components`](https://github.com/antfu/unplugin-vue-components). + +## Icons + +You can use icons from almost any icon sets by the power of [Iconify](https://iconify.design/). diff --git a/blitherboom-blog/layouts/README.md b/blitherboom-blog/layouts/README.md new file mode 100644 index 00000000..f7b8fcd3 --- /dev/null +++ b/blitherboom-blog/layouts/README.md @@ -0,0 +1,3 @@ +# layouts + +You can override valaxy/theme layouts here. diff --git a/blitherboom-blog/locales/README.md b/blitherboom-blog/locales/README.md new file mode 100644 index 00000000..3fadeb74 --- /dev/null +++ b/blitherboom-blog/locales/README.md @@ -0,0 +1,3 @@ +# locales + +You can custom i18n here. diff --git a/blitherboom-blog/locales/en.yml b/blitherboom-blog/locales/en.yml new file mode 100644 index 00000000..251fa06f --- /dev/null +++ b/blitherboom-blog/locales/en.yml @@ -0,0 +1,4 @@ +# you can custom locale +intro: + desc: Valaxy Template + hi: Hello, Valaxy! diff --git a/blitherboom-blog/locales/zh-CN.yml b/blitherboom-blog/locales/zh-CN.yml new file mode 100644 index 00000000..541233c9 --- /dev/null +++ b/blitherboom-blog/locales/zh-CN.yml @@ -0,0 +1,4 @@ +# 你可以像这样自定义 i18n +intro: + desc: Valaxy 模版 + hi: 你好,Valaxy diff --git a/blitherboom-blog/netlify.toml b/blitherboom-blog/netlify.toml new file mode 100644 index 00000000..c3f3bdff --- /dev/null +++ b/blitherboom-blog/netlify.toml @@ -0,0 +1,17 @@ +[build] +publish = "dist" +command = "npm run build" + +[build.environment] +NODE_VERSION = "16" + +[[redirects]] +from = "/*" +to = "/index.html" +status = 200 + +[[headers]] +for = "/manifest.webmanifest" + +[headers.values] +Content-Type = "application/manifest+json" diff --git a/blitherboom-blog/package.json b/blitherboom-blog/package.json new file mode 100644 index 00000000..91bdcf9c --- /dev/null +++ b/blitherboom-blog/package.json @@ -0,0 +1,21 @@ +{ + "name": "blitherboom-blog", + "type": "module", + "version": "0.0.0", + "private": true, + "scripts": { + "build": "npm run build:ssg", + "build:spa": "valaxy build", + "build:ssg": "valaxy build --ssg", + "dev": "valaxy", + "rss": "valaxy rss", + "serve": "vite preview" + }, + "dependencies": { + "valaxy": "0.18.5", + "valaxy-theme-yun": "0.18.5" + }, + "devDependencies": { + "typescript": "^5.3.3" + } +} diff --git a/blitherboom-blog/pages/404.md b/blitherboom-blog/pages/404.md new file mode 100644 index 00000000..c4e870fd --- /dev/null +++ b/blitherboom-blog/pages/404.md @@ -0,0 +1,3 @@ +--- +layout: 404 +--- diff --git a/blitherboom-blog/pages/about/index.md b/blitherboom-blog/pages/about/index.md new file mode 100644 index 00000000..22226b37 --- /dev/null +++ b/blitherboom-blog/pages/about/index.md @@ -0,0 +1,15 @@ +--- +title: 关于我 +--- + +I am developing [Valaxy](https://github.com/YunYouJun/valaxy) - Next Generation Static Blog Framework. + +If you like it, you can sponsor me in [GitHub](https://github.com/sponsors/YunYouJun) or [sponsors.yunyoujun.cn](https://sponsors.yunyoujun.cn). + +--- + +我正在开发 [Valaxy](https://github.com/YunYouJun/valaxy) - 下一代静态博客框架。 + +如果你喜欢它,你可以在 [GitHub](https://github.com/sponsors/YunYouJun) 或 [sponsors.yunyoujun.cn](https://sponsors.yunyoujun.cn) 赞助我。 + +Check out the [Valaxy | GitHub](https://github.com/YunYouJun/valaxy) for more details. diff --git a/blitherboom-blog/pages/about/site.md b/blitherboom-blog/pages/about/site.md new file mode 100644 index 00000000..343a8cc2 --- /dev/null +++ b/blitherboom-blog/pages/about/site.md @@ -0,0 +1,7 @@ +--- +title: 关于站点 +--- + +Valaxy + valaxy-theme-yun Demo Site + +- Default Theme: [valaxy-theme-yun](https://github.com/YunYouJun/valaxy/blob/main/packages/valaxy-theme-yun/) diff --git a/blitherboom-blog/pages/archives/index.md b/blitherboom-blog/pages/archives/index.md new file mode 100644 index 00000000..2a91e399 --- /dev/null +++ b/blitherboom-blog/pages/archives/index.md @@ -0,0 +1,5 @@ +--- +layout: archives +nav: false +comment: false +--- diff --git a/blitherboom-blog/pages/categories/index.md b/blitherboom-blog/pages/categories/index.md new file mode 100644 index 00000000..6452831d --- /dev/null +++ b/blitherboom-blog/pages/categories/index.md @@ -0,0 +1,9 @@ +--- +layout: categories +nav: false +toc: false +icon: i-ri-folder-2-line +# You can custom title +# title: 云游的小分类 +# comment: false +--- diff --git a/blitherboom-blog/pages/css/fonts.css b/blitherboom-blog/pages/css/fonts.css new file mode 100644 index 00000000..23a33c29 --- /dev/null +++ b/blitherboom-blog/pages/css/fonts.css @@ -0,0 +1,70 @@ +@font-face { + font-family: "宋体"; + font-weight: normal; + font-style: normal; + src: url("/fonts/SIMSUN.TTC"); +} + +@font-face { + font-family: "华文宋体"; + font-weight: normal; + font-style: normal; + src: url("/fonts/STSONG.TTF"); +} + +@font-face { + font-family: "华文宋体"; + font-weight: normal; + font-style: italic; + src: url("/fonts/STKAITI.TTF"); +} + +@font-face { + font-family: "华文楷体"; + font-weight: normal; + font-style: normal; + src: url("/fonts/STKAITI.TTF"); +} + +@font-face { + font-family: "华文仿宋"; + font-weight: normal; + font-style: normal; + src: url("/fonts/STFANGSO.TTF"); +} + +@font-face { + font-family: "SmileySans"; + font-weight: normal; + font-style: normal; + src: url("/fonts/SmileySans-Oblique.otf"); +} + + +@font-face { + font-family: "Latin Modern Roman 10"; + font-weight: normal; + font-style: normal; + src: url("/fonts/LMROMAN10-REGULAR.OTF"); +} + +@font-face { + font-family: "Latin Modern Roman 10"; + font-weight: bold; + font-style: normal; + src: url("/fonts/LMROMAN10-BOLD.OTF"); +} + +@font-face { + font-family: "Latin Modern Roman 10"; + font-weight: normal; + font-style: italic; + src: url("/fonts/LMROMAN10-ITALIC.OTF"); +} + +@font-face { + font-family: "Latin Modern Roman 10"; + font-weight: bold; + font-style: italic; + src: url("/fonts/LMROMAN10-BOLDITALIC.OTF"); +} \ No newline at end of file diff --git a/blitherboom-blog/pages/css/latex.css b/blitherboom-blog/pages/css/latex.css new file mode 100644 index 00000000..0b037c8f --- /dev/null +++ b/blitherboom-blog/pages/css/latex.css @@ -0,0 +1,512 @@ +@charset "UTF-8"; +:root { + /* == 字体设置 == */ + /* 基准字体 */ + /* 备选:Times, "Times New Roman" */ + --base-Latin-font: "Latin Modern Roman", "Latin Modern Roman 10", Times; + --base-Chinese-font: "华文宋体", "宋体", "微软雅黑"; + --base-font-size: 13pt; + /* 引言字体 */ + --quote-font: "Latin Modern Roman", "Latin Modern Roman 10", Times, + "Times New Roman", "华文仿宋"; + /* em单位为一个正文字符(--base-font-size)大小, + 例如,如果您设置 --base-font-size 为 9.5pt,那么 1.05em = 1.05*9.5pt ≈ 10pt。下面的标题字体等设置也遵循该规则。 + 这样,您就可以仅通过调整基准字体大小,而动态对其他元素大小做出调整。 + 当然,您也可以直接设置以pt或px为单位的数值,将元素的大小固定下来,如 --quote-font-size: 10pt; */ + --quote-font-size: 1.05em; + /* 代码字体(代码中的中文会调用 ui-font) */ + /* "Courier New" 从 Windows 3.1 起成为 Windows 官方提供的字体 */ + /* "Consolas" 从 Windows Vista 起成为 Windows 官方提供的字体 */ + --code-font: "Latin Modern Mono", "Latin Modern Mono 10", "Consolas", "Courier New"; + /* 侧边栏字体 */ + --ui-font: "阿里巴巴普惠体 2.0", "微软雅黑"; + /* source mode 字体 */ + /* 默认调用 code-font 和 ui-font */ + --sourceMode-font: "SF Mono", "阿里巴巴普惠体 2.0", "微软雅黑"; + /* 目录字体 */ + /* 默认调用 base-font */ + --toc-font: ""; + /* 默认调用 base-font-size */ + --toc-font-size: ""; + /* 公式字体 */ + --math-font-size: 1em; + /* 表格字体 */ + /* 默认调用 heading-font */ + --table-title-font: ""; + /* 默认调用 base-font */ + --table-font: ""; + /* 标题字体(总设置) */ + --heading-Latin-font: var(--base-Latin-font); + --heading-Chinese-font: "Noto Serif SC"; + /* 标题字体分别设置 */ + /* 大标题(h1)字体 */ + --title-Chinese-font: "Noto Serif SC"; + --title-font-size: 1.9em; + /* h2字体 */ + --h2-Chinese-font: "Noto Serif SC"; + --h2-font-size: 1.5em; + /* h3字体 */ + --h3-Chinese-font: "Noto Serif SC"; + --h3-font-size: 1.25em; + /* h4字体 */ + --h4-Chinese-font: "华文楷体"; + --h4-font-size: 1.15em; + /* h5字体 */ + --h5-Chinese-font: "华文仿宋"; + --h5-font-size: 1.10em; + /* h6字体 */ + --h6-Chinese-font: "华文仿宋"; + --h6-font-size: 1.05em; + /* 粗体样式设置 */ + /* 加粗风格时使用的字重;400等同于 normal,700等同于 bold,900等同于 heavy */ + --strong-weight: 900; + /* 基础行距 */ + --base-line-height: 1.618em; + /* == 页面设置 == */ + /* 打印页边距 */ + --set-margin: 1.8cm 2cm 1.2cm 2cm !important; + /* == 控制设置 == */ + /* 目录中是否显示一级标题 */ + --toc-show-title: none; + /* == 颜色设置 == */ + /* 超链接颜色 */ + --link-color-light: #2E67D3; + --link-color-dark: #8bb1f9; +} + +body { + padding: 0 !important; + margin: 0 !important; + /* counter-reset: tableHead 0 imgHead 0; */ +} + + + +@media print { + #write { + padding: 0 !important; + } + + @page { + margin: 1.8cm 2cm 1.2cm 2cm !important; + /* 页边距 */ + } +} +.markdown-body { + font-family: var(--base-Latin-font), var(--base-Chinese-font); + font-size: var(--base-font-size); + /* A4标准宽度 */ + max-width: 21cm; + /* column-count: 2; + column-gap: 25px; + column-width: 8cm; + display: inline-block; */ + /* 这里可以试分栏的,但确实不适合实现 */ +} +#write .md-math-block, +#write .md-rawblock, +#write p { + margin-top: 1em; + margin-bottom: 1em; +} +#write p { + text-align: left; + line-height: var(--base-line-height); +} +#write a { + color: var(--link-color-light); +} + +hr { + border-top: solid 1px #ddd; + margin-top: 1.8em; + margin-bottom: 1.8em; +} + +img { + /* 避免图片在导出时被断开 */ + page-break-inside: avoid; +} + +strong { + font-weight: var(--strong-weight); +} + +@media screen { + #write { + padding: var(--set-margin); + /* 添加一个淡蓝色的边框 */ + /* border: 0.8px solid #AAC ; */ + /* 页边阴影 */ + box-shadow: 0 0 24px 12px #cccccc; + } +} +.MathJax { + font-size: var(--math-font-size); +} + +/* typora 编写模式 */ +#typora-source { + font-family: var(--sourceMode-font), var(--code-font), var(--ui-font), monospace; + line-height: 2em; +} + +/* 侧边大纲标题 */ +.sidebar-content .outline-h1 { + counter-reset: outline-h2; +} +.sidebar-content .outline-h2 { + counter-reset: outline-h3; +} +.sidebar-content .outline-h2 .outline-label:before { + counter-increment: outline-h2; + content: counter(outline-h2) " "; +} +.sidebar-content .outline-h3 { + counter-reset: outline-h4; +} +.sidebar-content .outline-h3 .outline-label:before { + counter-increment: outline-h3; + content: counter(outline-h2) "." counter(outline-h3) " "; +} +.sidebar-content .outline-h4 { + counter-reset: outline-h5; +} +.sidebar-content .outline-h4 .outline-label:before { + counter-increment: outline-h4; + content: counter(outline-h2) "." counter(outline-h3) "." counter(outline-h4) " "; +} +.sidebar-content .outline-h5 { + counter-reset: outline-h6; +} +.sidebar-content .outline-h5 .outline-label:before { + counter-increment: outline-h5; + content: counter(outline-h2) "." counter(outline-h3) "." counter(outline-h4) "." counter(outline-h5) " "; +} + +.sidebar-content { + /* 侧边栏的字体修改 */ + font-family: var(--ui-font); + list-style: none; +} + +/* 元数据(如 YAML front matter)的背景框 */ +pre.md-meta-block { + background: #cccccc; + padding: 1.4em; + font-family: var(--code-font), var(--ui-font), monospace; + font-size: 0.8em; +} + +.markdown-body > h3.md-focus:before, +.markdown-body > h4.md-focus:before, +.markdown-body > h5.md-focus:before, +.markdown-body > h6.md-focus:before, +h3.md-focus:before, +h4.md-focus:before, +h5.md-focus:before, +h6.md-focus:before { + color: inherit; + border: inherit; + border-radius: inherit; + position: inherit; + left: initial; + float: none; + top: initial; + font-size: inherit; + padding-left: inherit; + padding-right: inherit; + vertical-align: inherit; + font-weight: inherit; + line-height: inherit; +} + +.markdown-body { + counter-reset: h2 0 h3 0 h4 0 h5 0 h6 0; +} +h1, +.markdown-body h2, +.markdown-body h3, +.markdown-body h4, +.markdown-body h5, +.markdown-body h6 { + font-weight: bold; + page-break-after: avoid !important; +} +h1 { + font-family: var(--heading-Latin-font), var(--title-Chinese-font), serif; + text-align: center; + column-span: all; + font-size: var(--title-font-size); +} +.markdown-body h2 { + font-family: var(--heading-Latin-font), var(--h2-Chinese-font), serif; + font-size: var(--h2-font-size); +} +.markdown-body h3 { + font-family: var(--heading-Latin-font), var(--h3-Chinese-font), serif; + font-size: var(--h3-font-size); + line-height: var(--h3-font-size); +} +.markdown-body h4 { + font-family: var(--heading-Latin-font), var(--h4-Chinese-font), serif; + font-size: var(--h4-font-size); + line-height: var(--h4-font-size); +} +.markdown-body h5 { + font-family: var(--heading-Latin-font), var(--h5-Chinese-font), serif; + font-size: var(--h5-font-size); + line-height: var(--h5-font-size); +} +.markdown-body h6 { + font-family: var(--heading-Latin-font), var(--h6-Chinese-font), serif; + font-size: var(--h6-font-size); + /* 没有写错,为了避免行距太小才这么写 */ + line-height: var(--h5-font-size); +} +h1 { + counter-reset: h2; +} +.markdown-body h2 { + counter-reset: h3; +} +.markdown-body h3 { + counter-reset: h4; +} +.markdown-body h4 { + counter-reset: h5; +} +.markdown-body h5 { + counter-reset: h6; +} + +.markdown-body h2:before { + counter-increment: h2; + content: counter(h2); + margin-right: 1.2em; +} + +.markdown-body h3:before, h3.markdown-body:before { + counter-increment: h3; + content: counter(h2) "." counter(h3); + margin-right: 1.2em; +} + +.markdown-body h4:before, h4.markdown-body:before { + counter-increment: h4; + content: counter(h2) "." counter(h3) "." counter(h4); + margin-right: 1.2em; +} + +.markdown-body h5:before, h5.markdown-body:before { + counter-increment: h5; + content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5); + margin-right: 1.2em; +} + +.markdown-body h6:before, h6.markdown-body:before { + counter-increment: h6; + content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6); + margin-right: 1.2em; +} + +/* 参考文献(脚注)块 */ +.footnotes { + font-size: 0.95em; +} + +.footnotes-area .footnote-line { + color: var(--text-color); +} +.footnotes-area hr { + border: 0; + color: #00000000; +} + +/* task列表 */ +.md-task-list-item > input { + margin-top: 0.42em; + margin-left: -1.5em; + width: 1em !important; + height: 1em !important; +} + +#write table { + /* 三线表第一条线宽度 */ + border-top: 1.2pt solid; + /* 三线表第二条线宽度 */ + border-bottom: 1.2pt solid; + font-family: var(--table-font), var(--base-Latin-font), var(--base-Chinese-font), serif; + /* font-size: var(--base-font-size); */ + text-align: center; + page-break-inside: avoid; + border-spacing: 6px; + /* 自动布局表格宽度,如果有时内容太紧建议直接加空格吧,我自己看不惯和页面等宽的大表格 */ + width: auto; + /* 使表格默认居中;虽然这个代码不好,但好像没别的实现办法 */ + margin: 0 auto; +} +#write table td { + padding: 2px; +} +#write table tr { + padding: 2px; +} +#write th { + padding: 0px 6px; +} +#write thead { + /* 表格标题(首行)样式 */ + /* 三线表表头的线 */ + border-bottom: 0.5pt solid; + font-family: var(--table-title-font), var(--heading-Latin-font), var(--heading-Chinese-font), serif !important; + font-size: var(--base-font-size); + font-weight: var(--strong-weight); +} + +/* 一个>的引言仅为两字符缩进,使用>>的引言为传统引言样式,具有左竖线、左缩进 */ +blockquote { + font-style: normal; + font-family: var(--quote-font), var(--base-Latin-font), var(--base-Chinese-font), -apple-system, serif; + font-size: var(--quote-font-size); + /* 文字离左边框的距离 */ + padding-left: 2em; + padding-right: 2em; + /* 左边框离页面边的距离 */ + margin-left: 0; +} + +blockquote p:first-child { + padding-top: 1ch; +} + +blockquote p:last-child { + padding-bottom: 1ch; +} + +blockquote blockquote { + border-left: 4px solid #b3b3b3; + padding-left: calc(2ch - 4px); + padding-right: 0; + margin-left: -4px; + border-radius: 0; +} + +/* 行内代码 */ +code { + font-family: var(--code-font), var(--ui-font), monospace; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code, +p code, +li code { + color: #3c70c6; + background-color: #fefefe; + /* 阴影 */ + box-shadow: 0 0 1px 1px #c8d3df; + font-family: var(--code-font), var(--ui-font), monospace; + box-sizing: border-box; + border-right: 0px; + margin: 0 2px 0 2px; + padding: 0 2px 0 2px; + /* 圆角 */ + border-radius: 2px 2px 2px 2px; +} + +/* 代码块样式 */ +.md-fences, +.CodeMirror pre { + font-size: 1em; +} + +.CodeMirror-wrap { + /* padding: 10px; */ + font-size: 1em; +} + +.CodeMirror-code pre { + font-family: var(--code-font), var(--ui-font), monospace; +} + +/* 目录 */ +.md-toc { + font-size: var(--toc-font-size); +} + +.md-toc-content { + margin-left: 2em; + /* 修复缺失上级标题时无法递增 */ + counter-reset: toc-h2 toc-h3 toc-h4; + page-break-after: always; +} + +.md-toc-inner { + margin-left: 0 !important; + color: var(--text-color) !important; +} + +.md-toc-item { + color: var(--text-color) !important; +} + +/* 目录标题内容属性 */ +.md-toc-h2, +.md-toc-h3, +.md-toc-h4, +.md-toc-h5, +.md-toc-h6 { + font-size: var(--toc-font-size); + font-family: var(--toc-font), var(--base-Latin-font), var(--base-Chinese-font), serif; +} + +.md-toc-h2 { + font-weight: var(--strong-weight); +} + +/* 目录标题前 */ +.md-toc-content .md-toc-h1 { + display: var(--toc-show-title); + counter-reset: toc-h2; +} +.md-toc-content .md-toc-h2 { + counter-reset: toc-h3; +} +.md-toc-content .md-toc-h3 { + counter-reset: toc-h4; +} +.md-toc-content .md-toc-h4 { + counter-reset: toc-h5; +} +.md-toc-content .md-toc-h5 { + counter-reset: toc-h6; +} +.md-toc-content .md-toc-h2:before { + counter-increment: toc-h2; + content: counter(toc-h2); + margin-right: 1em; + font-weight: var(--strong-weight); +} +.md-toc-content .md-toc-h3:before { + counter-increment: toc-h3; + content: counter(toc-h2) "." counter(toc-h3); + margin-left: 1.5em; + margin-right: 0.5em; +} +.md-toc-content .md-toc-h4:before { + counter-increment: toc-h4; + content: counter(toc-h2) "." counter(toc-h3) "." counter(toc-h4); + margin-left: 3.5em; + margin-right: 0.5em; +} +.md-toc-content .md-toc-h5:before { + counter-increment: toc-h5; + content: counter(toc-h2) "." counter(toc-h3) "." counter(toc-h4) "." counter(toc-h5); + margin-left: 5.5em; + margin-right: 0.5em; +} +.md-toc-content .md-toc-h6:before { + counter-increment: toc-h6; + content: counter(toc-h2) "." counter(toc-h3) "." counter(toc-h4) "." counter(toc-h5) "." counter(toc-h6); + margin-left: 7.5em; + margin-right: 0.5em; +} diff --git a/blitherboom-blog/pages/css/latex_backup.css b/blitherboom-blog/pages/css/latex_backup.css new file mode 100644 index 00000000..d4e5a6ac --- /dev/null +++ b/blitherboom-blog/pages/css/latex_backup.css @@ -0,0 +1,573 @@ +@charset "UTF-8"; +:root { + /* == 字体设置 == */ + /* 基准字体 */ + /* 备选:Times, "Times New Roman" */ + --base-Latin-font: "Latin Modern Roman", "Latin Modern Roman 10", Times; + --base-Chinese-font: "宋体", "华文宋体", "Noto Serif CJK SC", "微软雅黑"; + --base-font-size: 13pt; + /* 引言字体 */ + --quote-font: "Latin Modern Roman", "Latin Modern Roman 10", Times, + "Times New Roman", "华文仿宋"; + /* em单位为一个正文字符(--base-font-size)大小, + 例如,如果您设置 --base-font-size 为 9.5pt,那么 1.05em = 1.05*9.5pt ≈ 10pt。下面的标题字体等设置也遵循该规则。 + 这样,您就可以仅通过调整基准字体大小,而动态对其他元素大小做出调整。 + 当然,您也可以直接设置以pt或px为单位的数值,将元素的大小固定下来,如 --quote-font-size: 10pt; */ + --quote-font-size: 1.05em; + /* 代码字体(代码中的中文会调用 ui-font) */ + /* "Courier New" 从 Windows 3.1 起成为 Windows 官方提供的字体 */ + /* "Consolas" 从 Windows Vista 起成为 Windows 官方提供的字体 */ + --code-font: "Latin Modern Mono", "Latin Modern Mono 10", "Consolas", "Courier New"; + /* 侧边栏字体 */ + --ui-font: "阿里巴巴普惠体 2.0", "微软雅黑"; + /* source mode 字体 */ + /* 默认调用 code-font 和 ui-font */ + --sourceMode-font: "SF Mono", "阿里巴巴普惠体 2.0", "微软雅黑"; + /* 目录字体 */ + /* 默认调用 base-font */ + --toc-font: ""; + /* 默认调用 base-font-size */ + --toc-font-size: ""; + /* 公式字体 */ + --math-font-size: 1em; + /* 表格字体 */ + /* 默认调用 heading-font */ + --table-title-font: ""; + /* 默认调用 base-font */ + --table-font: ""; + /* 标题字体(总设置) */ + --heading-Latin-font: var(--base-Latin-font); + --heading-Chinese-font: "华光小标宋_CNKI"; + /* 标题字体分别设置 */ + /* 大标题(h1)字体 */ + --title-Chinese-font: "华光小标宋_CNKI"; + --title-font-size: 1.9em; + /* h2字体 */ + --h2-Chinese-font: "华光小标宋_CNKI"; + --h2-font-size: 1.5em; + /* h3字体 */ + --h3-Chinese-font: "华光小标宋_CNKI"; + --h3-font-size: 1.25em; + /* h4字体 */ + --h4-Chinese-font: "华文楷体"; + --h4-font-size: 1.15em; + /* h5字体 */ + --h5-Chinese-font: "华文仿宋"; + --h5-font-size: 1.10em; + /* h6字体 */ + --h6-Chinese-font: "华文仿宋"; + --h6-font-size: 1.05em; + /* 粗体样式设置 */ + /* 加粗风格时使用的字重;400等同于 normal,700等同于 bold,900等同于 heavy */ + --strong-weight: 900; + /* 基础行距 */ + --base-line-height: 1.618em; + /* == 页面设置 == */ + /* 打印页边距 */ + --set-margin: 1.8cm 2cm 1.2cm 2cm !important; + /* == 控制设置 == */ + /* 目录中是否显示一级标题 */ + --toc-show-title: none; + /* == 颜色设置 == */ + /* 超链接颜色 */ + --link-color-light: #2E67D3; + --link-color-dark: #8bb1f9; +} + +body { + padding: 0 !important; + margin: 0 !important; + /* counter-reset: tableHead 0 imgHead 0; */ +} + + + +@media print { + #write { + padding: 0 !important; + } + + @page { + margin: 1.8cm 2cm 1.2cm 2cm !important; + /* 页边距 */ + } +} +#write { + font-family: var(--base-Latin-font), var(--base-Chinese-font); + font-size: var(--base-font-size); + /* A4标准宽度 */ + max-width: 21cm; + background-color: white; + /* column-count: 2; + column-gap: 25px; + column-width: 8cm; + display: inline-block; */ + /* 这里可以试分栏的,但确实不适合实现 */ +} +#write .md-math-block, +#write .md-rawblock, +#write p { + margin-top: 1em; + margin-bottom: 1em; +} +#write p { + text-align: left; + line-height: var(--base-line-height); +} +#write a { + color: var(--link-color-light); +} + +hr { + border-top: solid 1px #ddd; + margin-top: 1.8em; + margin-bottom: 1.8em; +} + +img { + /* 避免图片在导出时被断开 */ + page-break-inside: avoid; +} + +strong { + font-weight: var(--strong-weight); +} + +@media screen { + #write { + padding: var(--set-margin); + /* 添加一个淡蓝色的边框 */ + /* border: 0.8px solid #AAC ; */ + /* 页边阴影 */ + box-shadow: 0 0 24px 12px #cccccc; + } +} +.MathJax { + font-size: var(--math-font-size); +} + +/* typora 编写模式 */ +#typora-source { + font-family: var(--sourceMode-font), var(--code-font), var(--ui-font), monospace; + line-height: 2em; +} + +/* 侧边大纲标题 */ +.sidebar-content .outline-h1 { + counter-reset: outline-h2; +} +.sidebar-content .outline-h2 { + counter-reset: outline-h3; +} +.sidebar-content .outline-h2 .outline-label:before { + counter-increment: outline-h2; + content: counter(outline-h2) " "; +} +.sidebar-content .outline-h3 { + counter-reset: outline-h4; +} +.sidebar-content .outline-h3 .outline-label:before { + counter-increment: outline-h3; + content: counter(outline-h2) "." counter(outline-h3) " "; +} +.sidebar-content .outline-h4 { + counter-reset: outline-h5; +} +.sidebar-content .outline-h4 .outline-label:before { + counter-increment: outline-h4; + content: counter(outline-h2) "." counter(outline-h3) "." counter(outline-h4) " "; +} +.sidebar-content .outline-h5 { + counter-reset: outline-h6; +} +.sidebar-content .outline-h5 .outline-label:before { + counter-increment: outline-h5; + content: counter(outline-h2) "." counter(outline-h3) "." counter(outline-h4) "." counter(outline-h5) " "; +} + +.sidebar-content { + /* 侧边栏的字体修改 */ + font-family: var(--ui-font); + list-style: none; +} + +/* 元数据(如 YAML front matter)的背景框 */ +pre.md-meta-block { + background: #cccccc; + padding: 1.4em; + font-family: var(--code-font), var(--ui-font), monospace; + font-size: 0.8em; +} + +#write > h3.md-focus:before, +#write > h4.md-focus:before, +#write > h5.md-focus:before, +#write > h6.md-focus:before, +h3.md-focus:before, +h4.md-focus:before, +h5.md-focus:before, +h6.md-focus:before { + color: inherit; + border: inherit; + border-radius: inherit; + position: inherit; + left: initial; + float: none; + top: initial; + font-size: inherit; + padding-left: inherit; + padding-right: inherit; + vertical-align: inherit; + font-weight: inherit; + line-height: inherit; +} + +#write { + counter-reset: h2 0 h3 0 h4 0 h5 0 h6 0; +} +#write h1, +.markdown-body h2, +.markdown-body h3, +.markdown-body h4, +.markdown-body h5, +.markdown-body h6 { + font-weight: bold; + page-break-after: avoid !important; +} +.post-header .post-title h1 { + font-family: var(--heading-Latin-font), var(--title-Chinese-font), serif; + text-align: center; + column-span: all; + font-size: var(--title-font-size); +} +.markdown-body h2 { + font-family: var(--heading-Latin-font), var(--h2-Chinese-font), serif; + font-size: var(--h2-font-size); +} +.markdown-body h3 { + font-family: var(--heading-Latin-font), var(--h3-Chinese-font), serif; + font-size: var(--h3-font-size); + line-height: var(--h3-font-size); +} +.markdown-body h4 { + font-family: var(--heading-Latin-font), var(--h4-Chinese-font), serif; + font-size: var(--h4-font-size); + line-height: var(--h4-font-size); +} +.markdown-body h5 { + font-family: var(--heading-Latin-font), var(--h5-Chinese-font), serif; + font-size: var(--h5-font-size); + line-height: var(--h5-font-size); +} +.markdown-body h6 { + font-family: var(--heading-Latin-font), var(--h6-Chinese-font), serif; + font-size: var(--h6-font-size); + /* 没有写错,为了避免行距太小才这么写 */ + line-height: var(--h5-font-size); +} +.markdown-body h1 { + counter-reset: h2; +} +.markdown-body h2 { + counter-reset: h3; +} +.markdown-body h3 { + counter-reset: h4; +} +.markdown-body h4 { + counter-reset: h5; +} +.markdown-body h5 { + counter-reset: h6; +} + +.markdown-body h2:before { + counter-increment: h2; + content: counter(h2); + margin-right: 1.2em; +} + +.markdown-body h3:before, h3.md-focus.md-heading:before { + counter-increment: h3; + content: counter(h2) "." counter(h3); + margin-right: 1.2em; +} + +.markdown-body h4:before, h4.md-focus.md-heading:before { + counter-increment: h4; + content: counter(h2) "." counter(h3) "." counter(h4); + margin-right: 1.2em; +} + +.markdown-body h5:before, h5.md-focus.md-heading:before { + counter-increment: h5; + content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5); + margin-right: 1.2em; +} + +.markdown-body h6:before, h6.md-focus.md-heading:before { + counter-increment: h6; + content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6); + margin-right: 1.2em; +} + +/* 参考文献(脚注)块 */ +.footnotes { + font-size: 0.95em; +} + +.footnotes-area .footnote-line { + color: var(--text-color); +} +.footnotes-area hr { + border: 0; + color: #00000000; +} + +/* 无序列表 */ +ul { + list-style: disc; +} +ul ul { + /*list-style: circle;*/ + /* 请勿删除“–”后的空格, 他们对缩进有一定影响, 下同 */ + list-style: "–   "; +} +ul ul ul { + list-style: "◦  "; +} + +/* 有序列表 */ +ol { + list-style: decimal; +} +ol ol { + counter-reset: liist; + list-style: none; +} +ol ol li { + counter-increment: liist; + position: relative; +} +ol ol li::before { + content: "(" counter(liist,lower-alpha) ")"; + position: absolute; + left: -1.8em; +} +ol ol ol { + counter-reset: liiist; + list-style: none; + margin: 0; +} +ol ol ol li { + counter-increment: liiist; + position: relative; +} +ol ol ol li::before { + content: counter(liiist,lower-roman) "."; + align-self: flex-end; + position: absolute; + left: -4.5em; + /* -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box;*/ + /* 为了让项目编号是重新用句点对齐而不是左对齐 */ + width: 4em; + text-align: right; +} + +li { + position: relative; +} + +ol, ul { + padding-inline-start: 2em; +} + +/* task列表 */ +.md-task-list-item > input { + margin-top: 0.42em; + margin-left: -1.5em; + width: 1em !important; + height: 1em !important; +} + +#write table { + /* 三线表第一条线宽度 */ + border-top: 1.2pt solid; + /* 三线表第二条线宽度 */ + border-bottom: 1.2pt solid; + font-family: var(--table-font), var(--base-Latin-font), var(--base-Chinese-font), serif; + /* font-size: var(--base-font-size); */ + text-align: center; + page-break-inside: avoid; + border-spacing: 6px; + /* 自动布局表格宽度,如果有时内容太紧建议直接加空格吧,我自己看不惯和页面等宽的大表格 */ + width: auto; + /* 使表格默认居中;虽然这个代码不好,但好像没别的实现办法 */ + margin: 0 auto; +} +#write table td { + padding: 2px; +} +#write table tr { + padding: 2px; +} +#write th { + padding: 0px 6px; +} +#write thead { + /* 表格标题(首行)样式 */ + /* 三线表表头的线 */ + border-bottom: 0.5pt solid; + font-family: var(--table-title-font), var(--heading-Latin-font), var(--heading-Chinese-font), serif !important; + font-size: var(--base-font-size); + font-weight: var(--strong-weight); +} + +/* 一个>的引言仅为两字符缩进,使用>>的引言为传统引言样式,具有左竖线、左缩进 */ +blockquote { + font-style: normal; + font-family: var(--quote-font), var(--base-Latin-font), var(--base-Chinese-font), -apple-system, serif; + font-size: var(--quote-font-size); + /* 文字离左边框的距离 */ + padding-left: 2em; + padding-right: 2em; + /* 左边框离页面边的距离 */ + margin-left: 0; +} + +blockquote p:first-child { + padding-top: 1ch; +} + +blockquote p:last-child { + padding-bottom: 1ch; +} + +blockquote blockquote { + border-left: 4px solid #b3b3b3; + padding-left: calc(2ch - 4px); + padding-right: 0; + margin-left: -4px; + border-radius: 0; +} + +/* 行内代码 */ +code { + font-family: var(--code-font), var(--ui-font), monospace; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code, +p code, +li code { + color: #3c70c6; + background-color: #fefefe; + /* 阴影 */ + box-shadow: 0 0 1px 1px #c8d3df; + font-family: var(--code-font), var(--ui-font), monospace; + box-sizing: border-box; + border-right: 0px; + margin: 0 2px 0 2px; + padding: 0 2px 0 2px; + /* 圆角 */ + border-radius: 2px 2px 2px 2px; +} + +/* 代码块样式 */ +.md-fences, +.CodeMirror pre { + font-size: 1em; +} + +.CodeMirror-wrap { + /* padding: 10px; */ + font-size: 1em; +} + +.CodeMirror-code pre { + font-family: var(--code-font), var(--ui-font), monospace; +} + +/* 目录 */ +.md-toc { + font-size: var(--toc-font-size); +} + +.md-toc-content { + margin-left: 2em; + /* 修复缺失上级标题时无法递增 */ + counter-reset: toc-h2 toc-h3 toc-h4; + page-break-after: always; +} + +.md-toc-inner { + margin-left: 0 !important; + color: var(--text-color) !important; +} + +.md-toc-item { + color: var(--text-color) !important; +} + +/* 目录标题内容属性 */ +.md-toc-h2, +.md-toc-h3, +.md-toc-h4, +.md-toc-h5, +.md-toc-h6 { + font-size: var(--toc-font-size); + font-family: var(--toc-font), var(--base-Latin-font), var(--base-Chinese-font), serif; +} + +.md-toc-h2 { + font-weight: var(--strong-weight); +} + +/* 目录标题前 */ +.md-toc-content .md-toc-h1 { + display: var(--toc-show-title); + counter-reset: toc-h2; +} +.md-toc-content .md-toc-h2 { + counter-reset: toc-h3; +} +.md-toc-content .md-toc-h3 { + counter-reset: toc-h4; +} +.md-toc-content .md-toc-h4 { + counter-reset: toc-h5; +} +.md-toc-content .md-toc-h5 { + counter-reset: toc-h6; +} +.md-toc-content .md-toc-h2:before { + counter-increment: toc-h2; + content: counter(toc-h2); + margin-right: 1em; + font-weight: var(--strong-weight); +} +.md-toc-content .md-toc-h3:before { + counter-increment: toc-h3; + content: counter(toc-h2) "." counter(toc-h3); + margin-left: 1.5em; + margin-right: 0.5em; +} +.md-toc-content .md-toc-h4:before { + counter-increment: toc-h4; + content: counter(toc-h2) "." counter(toc-h3) "." counter(toc-h4); + margin-left: 3.5em; + margin-right: 0.5em; +} +.md-toc-content .md-toc-h5:before { + counter-increment: toc-h5; + content: counter(toc-h2) "." counter(toc-h3) "." counter(toc-h4) "." counter(toc-h5); + margin-left: 5.5em; + margin-right: 0.5em; +} +.md-toc-content .md-toc-h6:before { + counter-increment: toc-h6; + content: counter(toc-h2) "." counter(toc-h3) "." counter(toc-h4) "." counter(toc-h5) "." counter(toc-h6); + margin-left: 7.5em; + margin-right: 0.5em; +} diff --git a/blitherboom-blog/pages/fonts/LMROMAN10-BOLD.OTF b/blitherboom-blog/pages/fonts/LMROMAN10-BOLD.OTF new file mode 100644 index 00000000..7d6afa73 Binary files /dev/null and b/blitherboom-blog/pages/fonts/LMROMAN10-BOLD.OTF differ diff --git a/blitherboom-blog/pages/fonts/LMROMAN10-BOLDITALIC.OTF b/blitherboom-blog/pages/fonts/LMROMAN10-BOLDITALIC.OTF new file mode 100644 index 00000000..98297be4 Binary files /dev/null and b/blitherboom-blog/pages/fonts/LMROMAN10-BOLDITALIC.OTF differ diff --git a/blitherboom-blog/pages/fonts/LMROMAN10-ITALIC.OTF b/blitherboom-blog/pages/fonts/LMROMAN10-ITALIC.OTF new file mode 100644 index 00000000..b3698737 Binary files /dev/null and b/blitherboom-blog/pages/fonts/LMROMAN10-ITALIC.OTF differ diff --git a/blitherboom-blog/pages/fonts/LMROMAN10-REGULAR.OTF b/blitherboom-blog/pages/fonts/LMROMAN10-REGULAR.OTF new file mode 100644 index 00000000..6a96b468 Binary files /dev/null and b/blitherboom-blog/pages/fonts/LMROMAN10-REGULAR.OTF differ diff --git a/blitherboom-blog/pages/fonts/SIMSUN.TTC b/blitherboom-blog/pages/fonts/SIMSUN.TTC new file mode 100644 index 00000000..6ca8de3d Binary files /dev/null and b/blitherboom-blog/pages/fonts/SIMSUN.TTC differ diff --git a/blitherboom-blog/pages/fonts/STFANGSO.TTF b/blitherboom-blog/pages/fonts/STFANGSO.TTF new file mode 100644 index 00000000..441f2883 Binary files /dev/null and b/blitherboom-blog/pages/fonts/STFANGSO.TTF differ diff --git a/blitherboom-blog/pages/fonts/STKAITI.TTF b/blitherboom-blog/pages/fonts/STKAITI.TTF new file mode 100644 index 00000000..50441161 Binary files /dev/null and b/blitherboom-blog/pages/fonts/STKAITI.TTF differ diff --git a/blitherboom-blog/pages/fonts/STSONG.TTF b/blitherboom-blog/pages/fonts/STSONG.TTF new file mode 100644 index 00000000..38706053 Binary files /dev/null and b/blitherboom-blog/pages/fonts/STSONG.TTF differ diff --git a/blitherboom-blog/pages/fonts/SmileySans-Oblique.otf b/blitherboom-blog/pages/fonts/SmileySans-Oblique.otf new file mode 100644 index 00000000..38a13654 Binary files /dev/null and b/blitherboom-blog/pages/fonts/SmileySans-Oblique.otf differ diff --git a/blitherboom-blog/pages/images/Antenna/1711090268476.png b/blitherboom-blog/pages/images/Antenna/1711090268476.png new file mode 100644 index 00000000..e3b5d75f Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711090268476.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711090528566.png b/blitherboom-blog/pages/images/Antenna/1711090528566.png new file mode 100644 index 00000000..91b14434 Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711090528566.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711090565574.png b/blitherboom-blog/pages/images/Antenna/1711090565574.png new file mode 100644 index 00000000..b1c35911 Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711090565574.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711091202619.png b/blitherboom-blog/pages/images/Antenna/1711091202619.png new file mode 100644 index 00000000..134b196c Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711091202619.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711091212947.png b/blitherboom-blog/pages/images/Antenna/1711091212947.png new file mode 100644 index 00000000..596804e5 Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711091212947.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711693683771.png b/blitherboom-blog/pages/images/Antenna/1711693683771.png new file mode 100644 index 00000000..686818fa Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711693683771.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711693701192.png b/blitherboom-blog/pages/images/Antenna/1711693701192.png new file mode 100644 index 00000000..6902e5f8 Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711693701192.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711693749686.png b/blitherboom-blog/pages/images/Antenna/1711693749686.png new file mode 100644 index 00000000..d9f08ebe Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711693749686.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711693845822.png b/blitherboom-blog/pages/images/Antenna/1711693845822.png new file mode 100644 index 00000000..ae234d3b Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711693845822.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711693861642.png b/blitherboom-blog/pages/images/Antenna/1711693861642.png new file mode 100644 index 00000000..2f846a7c Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711693861642.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711693936592.png b/blitherboom-blog/pages/images/Antenna/1711693936592.png new file mode 100644 index 00000000..4f94c1f5 Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711693936592.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711694027177.png b/blitherboom-blog/pages/images/Antenna/1711694027177.png new file mode 100644 index 00000000..7463b94c Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711694027177.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711694083583.png b/blitherboom-blog/pages/images/Antenna/1711694083583.png new file mode 100644 index 00000000..02980b18 Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711694083583.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711694243897.png b/blitherboom-blog/pages/images/Antenna/1711694243897.png new file mode 100644 index 00000000..6feafb16 Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711694243897.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711694350257.png b/blitherboom-blog/pages/images/Antenna/1711694350257.png new file mode 100644 index 00000000..32c4a8c8 Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711694350257.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711694462059.png b/blitherboom-blog/pages/images/Antenna/1711694462059.png new file mode 100644 index 00000000..56a7658e Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711694462059.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711694619870.png b/blitherboom-blog/pages/images/Antenna/1711694619870.png new file mode 100644 index 00000000..8e66a93c Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711694619870.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711694639638.png b/blitherboom-blog/pages/images/Antenna/1711694639638.png new file mode 100644 index 00000000..acef199d Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711694639638.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1711695738159.png b/blitherboom-blog/pages/images/Antenna/1711695738159.png new file mode 100644 index 00000000..5b6fc5b0 Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1711695738159.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1712471419276.png b/blitherboom-blog/pages/images/Antenna/1712471419276.png new file mode 100644 index 00000000..0b4e6651 Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1712471419276.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1712471436962.png b/blitherboom-blog/pages/images/Antenna/1712471436962.png new file mode 100644 index 00000000..34f74a61 Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1712471436962.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1712471499226.png b/blitherboom-blog/pages/images/Antenna/1712471499226.png new file mode 100644 index 00000000..d325a749 Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1712471499226.png differ diff --git a/blitherboom-blog/pages/images/Antenna/1712473473687.png b/blitherboom-blog/pages/images/Antenna/1712473473687.png new file mode 100644 index 00000000..0b7d8237 Binary files /dev/null and b/blitherboom-blog/pages/images/Antenna/1712473473687.png differ diff --git a/blitherboom-blog/pages/images/DSA/Dijkstra.jpg b/blitherboom-blog/pages/images/DSA/Dijkstra.jpg new file mode 100644 index 00000000..fc96f124 Binary files /dev/null and b/blitherboom-blog/pages/images/DSA/Dijkstra.jpg differ diff --git a/blitherboom-blog/pages/images/DSA/Duopule.jpg b/blitherboom-blog/pages/images/DSA/Duopule.jpg new file mode 100644 index 00000000..dcb1cf00 Binary files /dev/null and b/blitherboom-blog/pages/images/DSA/Duopule.jpg differ diff --git a/blitherboom-blog/pages/images/DSA/Kruskal.jpg b/blitherboom-blog/pages/images/DSA/Kruskal.jpg new file mode 100644 index 00000000..e4ce9851 Binary files /dev/null and b/blitherboom-blog/pages/images/DSA/Kruskal.jpg differ diff --git a/blitherboom-blog/pages/images/DSA/Prim.jpg b/blitherboom-blog/pages/images/DSA/Prim.jpg new file mode 100644 index 00000000..6aa11b09 Binary files /dev/null and b/blitherboom-blog/pages/images/DSA/Prim.jpg differ diff --git a/blitherboom-blog/pages/images/DSA/waveDuopl.jpg b/blitherboom-blog/pages/images/DSA/waveDuopl.jpg new file mode 100644 index 00000000..667a1f9c Binary files /dev/null and b/blitherboom-blog/pages/images/DSA/waveDuopl.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/2_1.jpg b/blitherboom-blog/pages/images/DSD/2_1.jpg new file mode 100644 index 00000000..54ec0863 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/2_1.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/2_2.jpg b/blitherboom-blog/pages/images/DSD/2_2.jpg new file mode 100644 index 00000000..98346183 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/2_2.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/2_3.jpg b/blitherboom-blog/pages/images/DSD/2_3.jpg new file mode 100644 index 00000000..81f76dd9 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/2_3.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/2_4.jpg b/blitherboom-blog/pages/images/DSD/2_4.jpg new file mode 100644 index 00000000..abe32b06 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/2_4.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/3_1.jpg b/blitherboom-blog/pages/images/DSD/3_1.jpg new file mode 100644 index 00000000..ea8bee23 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/3_1.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/3_10.jpg b/blitherboom-blog/pages/images/DSD/3_10.jpg new file mode 100644 index 00000000..8866cafd Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/3_10.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/3_2.jpg b/blitherboom-blog/pages/images/DSD/3_2.jpg new file mode 100644 index 00000000..5ec716b2 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/3_2.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/3_3.jpg b/blitherboom-blog/pages/images/DSD/3_3.jpg new file mode 100644 index 00000000..20a99f5b Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/3_3.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/3_4.jpg b/blitherboom-blog/pages/images/DSD/3_4.jpg new file mode 100644 index 00000000..5ca18dbb Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/3_4.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/3_5.jpg b/blitherboom-blog/pages/images/DSD/3_5.jpg new file mode 100644 index 00000000..34eecb22 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/3_5.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/3_6.jpg b/blitherboom-blog/pages/images/DSD/3_6.jpg new file mode 100644 index 00000000..9bfaada0 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/3_6.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/3_7.jpg b/blitherboom-blog/pages/images/DSD/3_7.jpg new file mode 100644 index 00000000..4228d271 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/3_7.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/3_8.jpg b/blitherboom-blog/pages/images/DSD/3_8.jpg new file mode 100644 index 00000000..c74d08ad Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/3_8.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/3_9.jpg b/blitherboom-blog/pages/images/DSD/3_9.jpg new file mode 100644 index 00000000..93d0166e Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/3_9.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/4_1.jpg b/blitherboom-blog/pages/images/DSD/4_1.jpg new file mode 100644 index 00000000..8772987b Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/4_1.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/4_10.jpg b/blitherboom-blog/pages/images/DSD/4_10.jpg new file mode 100644 index 00000000..fc93d857 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/4_10.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/4_2.jpg b/blitherboom-blog/pages/images/DSD/4_2.jpg new file mode 100644 index 00000000..7a440e0f Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/4_2.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/4_3.jpg b/blitherboom-blog/pages/images/DSD/4_3.jpg new file mode 100644 index 00000000..019517d5 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/4_3.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/4_4.jpg b/blitherboom-blog/pages/images/DSD/4_4.jpg new file mode 100644 index 00000000..e5277942 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/4_4.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/4_5.jpg b/blitherboom-blog/pages/images/DSD/4_5.jpg new file mode 100644 index 00000000..64a4239e Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/4_5.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/4_6.jpg b/blitherboom-blog/pages/images/DSD/4_6.jpg new file mode 100644 index 00000000..30af2a51 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/4_6.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/4_7.jpg b/blitherboom-blog/pages/images/DSD/4_7.jpg new file mode 100644 index 00000000..7bc297a8 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/4_7.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/4_8.jpg b/blitherboom-blog/pages/images/DSD/4_8.jpg new file mode 100644 index 00000000..d689c9c2 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/4_8.jpg differ diff --git a/blitherboom-blog/pages/images/DSD/4_9.jpg b/blitherboom-blog/pages/images/DSD/4_9.jpg new file mode 100644 index 00000000..5b61cf77 Binary files /dev/null and b/blitherboom-blog/pages/images/DSD/4_9.jpg differ diff --git a/blitherboom-blog/pages/images/DSP/4_2.jpg b/blitherboom-blog/pages/images/DSP/4_2.jpg new file mode 100644 index 00000000..42e1a9e3 Binary files /dev/null and b/blitherboom-blog/pages/images/DSP/4_2.jpg differ diff --git a/blitherboom-blog/pages/images/DSP/5_1.jpg b/blitherboom-blog/pages/images/DSP/5_1.jpg new file mode 100644 index 00000000..686eac04 Binary files /dev/null and b/blitherboom-blog/pages/images/DSP/5_1.jpg differ diff --git a/blitherboom-blog/pages/images/DSP/5_2.jpg b/blitherboom-blog/pages/images/DSP/5_2.jpg new file mode 100644 index 00000000..067cd365 Binary files /dev/null and b/blitherboom-blog/pages/images/DSP/5_2.jpg differ diff --git a/blitherboom-blog/pages/images/StaSP/1711254850893.png b/blitherboom-blog/pages/images/StaSP/1711254850893.png new file mode 100644 index 00000000..c995e3db Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711254850893.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1711255303038.png b/blitherboom-blog/pages/images/StaSP/1711255303038.png new file mode 100644 index 00000000..7289f69a Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711255303038.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1711339154789.png b/blitherboom-blog/pages/images/StaSP/1711339154789.png new file mode 100644 index 00000000..dc126ef5 Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711339154789.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1711339192281.png b/blitherboom-blog/pages/images/StaSP/1711339192281.png new file mode 100644 index 00000000..8b862a95 Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711339192281.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1711339216759.png b/blitherboom-blog/pages/images/StaSP/1711339216759.png new file mode 100644 index 00000000..470e2414 Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711339216759.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1711339249863.png b/blitherboom-blog/pages/images/StaSP/1711339249863.png new file mode 100644 index 00000000..266ea546 Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711339249863.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1711339773571.png b/blitherboom-blog/pages/images/StaSP/1711339773571.png new file mode 100644 index 00000000..bde773df Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711339773571.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1711339786814.png b/blitherboom-blog/pages/images/StaSP/1711339786814.png new file mode 100644 index 00000000..4143d8aa Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711339786814.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1711339831807.png b/blitherboom-blog/pages/images/StaSP/1711339831807.png new file mode 100644 index 00000000..da2226ec Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711339831807.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1711339865703.png b/blitherboom-blog/pages/images/StaSP/1711339865703.png new file mode 100644 index 00000000..d7240c5b Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711339865703.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1711340151724.png b/blitherboom-blog/pages/images/StaSP/1711340151724.png new file mode 100644 index 00000000..72d3be84 Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711340151724.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1711340163113.png b/blitherboom-blog/pages/images/StaSP/1711340163113.png new file mode 100644 index 00000000..01df7af8 Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711340163113.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1711340177961.png b/blitherboom-blog/pages/images/StaSP/1711340177961.png new file mode 100644 index 00000000..c79bfe75 Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711340177961.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1711340277148.png b/blitherboom-blog/pages/images/StaSP/1711340277148.png new file mode 100644 index 00000000..a2bc2ffe Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711340277148.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1711340293644.png b/blitherboom-blog/pages/images/StaSP/1711340293644.png new file mode 100644 index 00000000..e8a9468c Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1711340293644.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1712549632251.png b/blitherboom-blog/pages/images/StaSP/1712549632251.png new file mode 100644 index 00000000..b2d970f7 Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1712549632251.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1712549637885.png b/blitherboom-blog/pages/images/StaSP/1712549637885.png new file mode 100644 index 00000000..b2d970f7 Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1712549637885.png differ diff --git a/blitherboom-blog/pages/images/StaSP/1_1.jpg b/blitherboom-blog/pages/images/StaSP/1_1.jpg new file mode 100644 index 00000000..925ac496 Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/1_1.jpg differ diff --git a/blitherboom-blog/pages/images/StaSP/2_1.jpg b/blitherboom-blog/pages/images/StaSP/2_1.jpg new file mode 100644 index 00000000..b625c3cf Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/2_1.jpg differ diff --git a/blitherboom-blog/pages/images/StaSP/2_2.png b/blitherboom-blog/pages/images/StaSP/2_2.png new file mode 100644 index 00000000..4e8bf667 Binary files /dev/null and b/blitherboom-blog/pages/images/StaSP/2_2.png differ diff --git a/blitherboom-blog/pages/images/avatar.jpg b/blitherboom-blog/pages/images/avatar.jpg new file mode 100644 index 00000000..6ba08c0a Binary files /dev/null and b/blitherboom-blog/pages/images/avatar.jpg differ diff --git a/blitherboom-blog/pages/images/csapp1.jpg b/blitherboom-blog/pages/images/csapp1.jpg new file mode 100644 index 00000000..25ea1a9e Binary files /dev/null and b/blitherboom-blog/pages/images/csapp1.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_10_1.jpg b/blitherboom-blog/pages/images/digital/lec_10_1.jpg new file mode 100644 index 00000000..6411afb3 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_10_1.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_10_10.jpg b/blitherboom-blog/pages/images/digital/lec_10_10.jpg new file mode 100644 index 00000000..7f453380 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_10_10.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_10_2.jpg b/blitherboom-blog/pages/images/digital/lec_10_2.jpg new file mode 100644 index 00000000..627e2c69 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_10_2.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_10_3.jpg b/blitherboom-blog/pages/images/digital/lec_10_3.jpg new file mode 100644 index 00000000..10fa02d1 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_10_3.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_10_4.jpg b/blitherboom-blog/pages/images/digital/lec_10_4.jpg new file mode 100644 index 00000000..53a85476 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_10_4.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_10_5.jpg b/blitherboom-blog/pages/images/digital/lec_10_5.jpg new file mode 100644 index 00000000..2d356d4a Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_10_5.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_10_6.jpg b/blitherboom-blog/pages/images/digital/lec_10_6.jpg new file mode 100644 index 00000000..8e0198f3 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_10_6.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_10_7.jpg b/blitherboom-blog/pages/images/digital/lec_10_7.jpg new file mode 100644 index 00000000..04e0140c Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_10_7.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_10_8.jpg b/blitherboom-blog/pages/images/digital/lec_10_8.jpg new file mode 100644 index 00000000..71c959a1 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_10_8.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_10_9.jpg b/blitherboom-blog/pages/images/digital/lec_10_9.jpg new file mode 100644 index 00000000..b22698f3 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_10_9.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_11_1.jpg b/blitherboom-blog/pages/images/digital/lec_11_1.jpg new file mode 100644 index 00000000..ab8031d5 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_11_1.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_12_1.jpg b/blitherboom-blog/pages/images/digital/lec_12_1.jpg new file mode 100644 index 00000000..60bb3794 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_12_1.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_12_2.jpg b/blitherboom-blog/pages/images/digital/lec_12_2.jpg new file mode 100644 index 00000000..f0d85d6e Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_12_2.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_12_3.jpg b/blitherboom-blog/pages/images/digital/lec_12_3.jpg new file mode 100644 index 00000000..c586c8be Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_12_3.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_12_4.jpg b/blitherboom-blog/pages/images/digital/lec_12_4.jpg new file mode 100644 index 00000000..488fe19d Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_12_4.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_12_5.jpg b/blitherboom-blog/pages/images/digital/lec_12_5.jpg new file mode 100644 index 00000000..1fb2d92c Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_12_5.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_12_6.jpg b/blitherboom-blog/pages/images/digital/lec_12_6.jpg new file mode 100644 index 00000000..68d2e69b Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_12_6.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_3_1.jpg b/blitherboom-blog/pages/images/digital/lec_3_1.jpg new file mode 100644 index 00000000..7d1d9da8 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_3_1.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_1.jpg b/blitherboom-blog/pages/images/digital/lec_4_1.jpg new file mode 100644 index 00000000..d68d2879 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_1.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_1.jpg8.jpg b/blitherboom-blog/pages/images/digital/lec_4_1.jpg8.jpg new file mode 100644 index 00000000..10e9f427 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_1.jpg8.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_10.jpg b/blitherboom-blog/pages/images/digital/lec_4_10.jpg new file mode 100644 index 00000000..e6a99d33 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_10.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_11.jpg b/blitherboom-blog/pages/images/digital/lec_4_11.jpg new file mode 100644 index 00000000..4ea6a63b Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_11.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_12.jpg b/blitherboom-blog/pages/images/digital/lec_4_12.jpg new file mode 100644 index 00000000..0a221cfd Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_12.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_13.jpg b/blitherboom-blog/pages/images/digital/lec_4_13.jpg new file mode 100644 index 00000000..d320ad2b Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_13.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_14.jpg b/blitherboom-blog/pages/images/digital/lec_4_14.jpg new file mode 100644 index 00000000..8820dd7b Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_14.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_15.jpg b/blitherboom-blog/pages/images/digital/lec_4_15.jpg new file mode 100644 index 00000000..67231a8f Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_15.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_16.jpg b/blitherboom-blog/pages/images/digital/lec_4_16.jpg new file mode 100644 index 00000000..28334965 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_16.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_17.jpg b/blitherboom-blog/pages/images/digital/lec_4_17.jpg new file mode 100644 index 00000000..d8bc2f73 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_17.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_2.jpg b/blitherboom-blog/pages/images/digital/lec_4_2.jpg new file mode 100644 index 00000000..4fc7bfdd Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_2.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_3.jpg b/blitherboom-blog/pages/images/digital/lec_4_3.jpg new file mode 100644 index 00000000..bd02bdba Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_3.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_4.jpg b/blitherboom-blog/pages/images/digital/lec_4_4.jpg new file mode 100644 index 00000000..0cfde19b Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_4.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_5.jpg b/blitherboom-blog/pages/images/digital/lec_4_5.jpg new file mode 100644 index 00000000..10f67218 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_5.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_6.jpg b/blitherboom-blog/pages/images/digital/lec_4_6.jpg new file mode 100644 index 00000000..8907c6d2 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_6.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_7.jpg b/blitherboom-blog/pages/images/digital/lec_4_7.jpg new file mode 100644 index 00000000..6cd24eb7 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_7.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_8.jpg b/blitherboom-blog/pages/images/digital/lec_4_8.jpg new file mode 100644 index 00000000..daae1d40 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_8.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_4_9.jpg b/blitherboom-blog/pages/images/digital/lec_4_9.jpg new file mode 100644 index 00000000..ee90e06f Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_4_9.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_1.jpg b/blitherboom-blog/pages/images/digital/lec_5_1.jpg new file mode 100644 index 00000000..17ff3923 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_1.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_10.jpg b/blitherboom-blog/pages/images/digital/lec_5_10.jpg new file mode 100644 index 00000000..abfae423 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_10.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_11.jpg b/blitherboom-blog/pages/images/digital/lec_5_11.jpg new file mode 100644 index 00000000..ff5cd9d7 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_11.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_12.jpg b/blitherboom-blog/pages/images/digital/lec_5_12.jpg new file mode 100644 index 00000000..de6914d7 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_12.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_13.jpg b/blitherboom-blog/pages/images/digital/lec_5_13.jpg new file mode 100644 index 00000000..3af96d65 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_13.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_14.jpg b/blitherboom-blog/pages/images/digital/lec_5_14.jpg new file mode 100644 index 00000000..3d21dc0b Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_14.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_15.jpg b/blitherboom-blog/pages/images/digital/lec_5_15.jpg new file mode 100644 index 00000000..3bc41ff2 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_15.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_16.jpg b/blitherboom-blog/pages/images/digital/lec_5_16.jpg new file mode 100644 index 00000000..f38a5a4b Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_16.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_17.jpg b/blitherboom-blog/pages/images/digital/lec_5_17.jpg new file mode 100644 index 00000000..1453a9e1 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_17.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_18.jpg b/blitherboom-blog/pages/images/digital/lec_5_18.jpg new file mode 100644 index 00000000..874a5ec8 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_18.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_19.jpg b/blitherboom-blog/pages/images/digital/lec_5_19.jpg new file mode 100644 index 00000000..f528435b Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_19.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_2.jpg b/blitherboom-blog/pages/images/digital/lec_5_2.jpg new file mode 100644 index 00000000..8627c182 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_2.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_20.jpg b/blitherboom-blog/pages/images/digital/lec_5_20.jpg new file mode 100644 index 00000000..235a35be Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_20.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_21.jpg b/blitherboom-blog/pages/images/digital/lec_5_21.jpg new file mode 100644 index 00000000..a84e949e Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_21.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_22.jpg b/blitherboom-blog/pages/images/digital/lec_5_22.jpg new file mode 100644 index 00000000..337f729e Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_22.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_23.jpg b/blitherboom-blog/pages/images/digital/lec_5_23.jpg new file mode 100644 index 00000000..f329114b Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_23.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_24.jpg b/blitherboom-blog/pages/images/digital/lec_5_24.jpg new file mode 100644 index 00000000..bac85772 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_24.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_25.jpg b/blitherboom-blog/pages/images/digital/lec_5_25.jpg new file mode 100644 index 00000000..76278c3b Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_25.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_26.jpg b/blitherboom-blog/pages/images/digital/lec_5_26.jpg new file mode 100644 index 00000000..349b7aca Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_26.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_3.jpg b/blitherboom-blog/pages/images/digital/lec_5_3.jpg new file mode 100644 index 00000000..a553a5b7 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_3.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_4.jpg b/blitherboom-blog/pages/images/digital/lec_5_4.jpg new file mode 100644 index 00000000..2cf0bbb2 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_4.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_5.jpg b/blitherboom-blog/pages/images/digital/lec_5_5.jpg new file mode 100644 index 00000000..eec77c1d Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_5.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_6.jpg b/blitherboom-blog/pages/images/digital/lec_5_6.jpg new file mode 100644 index 00000000..72415f31 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_6.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_7.jpg b/blitherboom-blog/pages/images/digital/lec_5_7.jpg new file mode 100644 index 00000000..985d333d Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_7.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_8.jpg b/blitherboom-blog/pages/images/digital/lec_5_8.jpg new file mode 100644 index 00000000..ab65d11c Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_8.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_5_9.jpg b/blitherboom-blog/pages/images/digital/lec_5_9.jpg new file mode 100644 index 00000000..dcc406df Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_5_9.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_6_1.jpg b/blitherboom-blog/pages/images/digital/lec_6_1.jpg new file mode 100644 index 00000000..ad461b67 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_6_1.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_6_2.jpg b/blitherboom-blog/pages/images/digital/lec_6_2.jpg new file mode 100644 index 00000000..f4438af0 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_6_2.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_6_3.jpg b/blitherboom-blog/pages/images/digital/lec_6_3.jpg new file mode 100644 index 00000000..d96080ad Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_6_3.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_6_4.jpg b/blitherboom-blog/pages/images/digital/lec_6_4.jpg new file mode 100644 index 00000000..5e538f07 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_6_4.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_6_5.jpg b/blitherboom-blog/pages/images/digital/lec_6_5.jpg new file mode 100644 index 00000000..0b3d4fff Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_6_5.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_6_6.jpg b/blitherboom-blog/pages/images/digital/lec_6_6.jpg new file mode 100644 index 00000000..17bbf808 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_6_6.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_6_7.jpg b/blitherboom-blog/pages/images/digital/lec_6_7.jpg new file mode 100644 index 00000000..45b698e3 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_6_7.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_6_8.jpg b/blitherboom-blog/pages/images/digital/lec_6_8.jpg new file mode 100644 index 00000000..a727501a Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_6_8.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_6_9.jpg b/blitherboom-blog/pages/images/digital/lec_6_9.jpg new file mode 100644 index 00000000..abe134d7 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_6_9.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_.jpg b/blitherboom-blog/pages/images/digital/lec_7_.jpg new file mode 100644 index 00000000..ed457da6 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_1.jpg b/blitherboom-blog/pages/images/digital/lec_7_1.jpg new file mode 100644 index 00000000..eb84319a Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_1.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_10.jpg b/blitherboom-blog/pages/images/digital/lec_7_10.jpg new file mode 100644 index 00000000..3aad3294 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_10.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_11.jpg b/blitherboom-blog/pages/images/digital/lec_7_11.jpg new file mode 100644 index 00000000..303a2b7d Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_11.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_12.jpg b/blitherboom-blog/pages/images/digital/lec_7_12.jpg new file mode 100644 index 00000000..72a76b2c Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_12.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_13.jpg b/blitherboom-blog/pages/images/digital/lec_7_13.jpg new file mode 100644 index 00000000..9c5871cb Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_13.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_14.jpg b/blitherboom-blog/pages/images/digital/lec_7_14.jpg new file mode 100644 index 00000000..afa9a33d Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_14.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_15.jpg b/blitherboom-blog/pages/images/digital/lec_7_15.jpg new file mode 100644 index 00000000..0f62a7c3 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_15.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_16.jpg b/blitherboom-blog/pages/images/digital/lec_7_16.jpg new file mode 100644 index 00000000..a98e7269 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_16.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_17.jpg b/blitherboom-blog/pages/images/digital/lec_7_17.jpg new file mode 100644 index 00000000..850df169 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_17.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_18.jpg b/blitherboom-blog/pages/images/digital/lec_7_18.jpg new file mode 100644 index 00000000..782bf815 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_18.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_19.jpg b/blitherboom-blog/pages/images/digital/lec_7_19.jpg new file mode 100644 index 00000000..eec02267 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_19.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_2.jpg b/blitherboom-blog/pages/images/digital/lec_7_2.jpg new file mode 100644 index 00000000..189aa6cb Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_2.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_20.jpg b/blitherboom-blog/pages/images/digital/lec_7_20.jpg new file mode 100644 index 00000000..0abc6522 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_20.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_21.jpg b/blitherboom-blog/pages/images/digital/lec_7_21.jpg new file mode 100644 index 00000000..1f35a4db Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_21.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_22.jpg b/blitherboom-blog/pages/images/digital/lec_7_22.jpg new file mode 100644 index 00000000..f929faa4 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_22.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_23.jpg b/blitherboom-blog/pages/images/digital/lec_7_23.jpg new file mode 100644 index 00000000..6d29bf16 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_23.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_24.jpg b/blitherboom-blog/pages/images/digital/lec_7_24.jpg new file mode 100644 index 00000000..a0fb1dfb Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_24.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_3.jpg b/blitherboom-blog/pages/images/digital/lec_7_3.jpg new file mode 100644 index 00000000..7169703d Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_3.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_4.jpg b/blitherboom-blog/pages/images/digital/lec_7_4.jpg new file mode 100644 index 00000000..de14e736 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_4.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_5.jpg b/blitherboom-blog/pages/images/digital/lec_7_5.jpg new file mode 100644 index 00000000..a5315db7 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_5.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_6.jpg b/blitherboom-blog/pages/images/digital/lec_7_6.jpg new file mode 100644 index 00000000..dba1af31 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_6.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_7.jpg b/blitherboom-blog/pages/images/digital/lec_7_7.jpg new file mode 100644 index 00000000..919c24a9 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_7.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_7_9.jpg b/blitherboom-blog/pages/images/digital/lec_7_9.jpg new file mode 100644 index 00000000..5164893d Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_7_9.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_1.jpg b/blitherboom-blog/pages/images/digital/lec_8_1.jpg new file mode 100644 index 00000000..f563e6ee Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_1.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_10.jpg b/blitherboom-blog/pages/images/digital/lec_8_10.jpg new file mode 100644 index 00000000..4292e9f7 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_10.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_11.jpg b/blitherboom-blog/pages/images/digital/lec_8_11.jpg new file mode 100644 index 00000000..1b8f344c Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_11.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_12.jpg b/blitherboom-blog/pages/images/digital/lec_8_12.jpg new file mode 100644 index 00000000..fecf3fad Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_12.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_13.jpg b/blitherboom-blog/pages/images/digital/lec_8_13.jpg new file mode 100644 index 00000000..19e021da Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_13.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_14.jpg b/blitherboom-blog/pages/images/digital/lec_8_14.jpg new file mode 100644 index 00000000..ad91eab0 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_14.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_15.jpg b/blitherboom-blog/pages/images/digital/lec_8_15.jpg new file mode 100644 index 00000000..b8dcb748 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_15.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_16.jpg b/blitherboom-blog/pages/images/digital/lec_8_16.jpg new file mode 100644 index 00000000..e0c6f2c1 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_16.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_17.jpg b/blitherboom-blog/pages/images/digital/lec_8_17.jpg new file mode 100644 index 00000000..6498c464 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_17.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_18.jpg b/blitherboom-blog/pages/images/digital/lec_8_18.jpg new file mode 100644 index 00000000..aa5aed33 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_18.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_19.jpg b/blitherboom-blog/pages/images/digital/lec_8_19.jpg new file mode 100644 index 00000000..09512ba3 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_19.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_2.jpg b/blitherboom-blog/pages/images/digital/lec_8_2.jpg new file mode 100644 index 00000000..8250f420 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_2.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_20.jpg b/blitherboom-blog/pages/images/digital/lec_8_20.jpg new file mode 100644 index 00000000..e9023229 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_20.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_21.jpg b/blitherboom-blog/pages/images/digital/lec_8_21.jpg new file mode 100644 index 00000000..37a72fe3 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_21.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_22.jpg b/blitherboom-blog/pages/images/digital/lec_8_22.jpg new file mode 100644 index 00000000..5913af00 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_22.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_23.jpg b/blitherboom-blog/pages/images/digital/lec_8_23.jpg new file mode 100644 index 00000000..0412c18d Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_23.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_24.jpg b/blitherboom-blog/pages/images/digital/lec_8_24.jpg new file mode 100644 index 00000000..632a9553 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_24.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_25.jpg b/blitherboom-blog/pages/images/digital/lec_8_25.jpg new file mode 100644 index 00000000..554431e9 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_25.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_26.jpg b/blitherboom-blog/pages/images/digital/lec_8_26.jpg new file mode 100644 index 00000000..0a870102 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_26.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_27.jpg b/blitherboom-blog/pages/images/digital/lec_8_27.jpg new file mode 100644 index 00000000..1bbc75bd Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_27.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_28.jpg b/blitherboom-blog/pages/images/digital/lec_8_28.jpg new file mode 100644 index 00000000..341f1c16 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_28.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_29.jpg b/blitherboom-blog/pages/images/digital/lec_8_29.jpg new file mode 100644 index 00000000..98b7fbba Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_29.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_3.jpg b/blitherboom-blog/pages/images/digital/lec_8_3.jpg new file mode 100644 index 00000000..300bd32a Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_3.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_30.jpg b/blitherboom-blog/pages/images/digital/lec_8_30.jpg new file mode 100644 index 00000000..509b8d3b Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_30.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_31.jpg b/blitherboom-blog/pages/images/digital/lec_8_31.jpg new file mode 100644 index 00000000..7c51a56a Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_31.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_4.jpg b/blitherboom-blog/pages/images/digital/lec_8_4.jpg new file mode 100644 index 00000000..a64d12fe Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_4.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_5.jpg b/blitherboom-blog/pages/images/digital/lec_8_5.jpg new file mode 100644 index 00000000..9aada323 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_5.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_6.jpg b/blitherboom-blog/pages/images/digital/lec_8_6.jpg new file mode 100644 index 00000000..238136f2 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_6.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_7.jpg b/blitherboom-blog/pages/images/digital/lec_8_7.jpg new file mode 100644 index 00000000..909f4bda Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_7.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_8.jpg b/blitherboom-blog/pages/images/digital/lec_8_8.jpg new file mode 100644 index 00000000..0db30e0d Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_8.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_8_9.jpg b/blitherboom-blog/pages/images/digital/lec_8_9.jpg new file mode 100644 index 00000000..5aa64465 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_8_9.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_1.jpg b/blitherboom-blog/pages/images/digital/lec_9_1.jpg new file mode 100644 index 00000000..e31913e0 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_1.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_10.jpg b/blitherboom-blog/pages/images/digital/lec_9_10.jpg new file mode 100644 index 00000000..e34434a7 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_10.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_11.jpg b/blitherboom-blog/pages/images/digital/lec_9_11.jpg new file mode 100644 index 00000000..0e4b2a1b Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_11.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_12.jpg b/blitherboom-blog/pages/images/digital/lec_9_12.jpg new file mode 100644 index 00000000..2524ed6e Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_12.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_13.jpg b/blitherboom-blog/pages/images/digital/lec_9_13.jpg new file mode 100644 index 00000000..0c33c548 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_13.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_14.jpg b/blitherboom-blog/pages/images/digital/lec_9_14.jpg new file mode 100644 index 00000000..2e5328ed Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_14.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_15.jpg b/blitherboom-blog/pages/images/digital/lec_9_15.jpg new file mode 100644 index 00000000..a5aef7c5 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_15.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_2.jpg b/blitherboom-blog/pages/images/digital/lec_9_2.jpg new file mode 100644 index 00000000..6006dcb2 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_2.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_3.jpg b/blitherboom-blog/pages/images/digital/lec_9_3.jpg new file mode 100644 index 00000000..19ac2872 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_3.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_4.jpg b/blitherboom-blog/pages/images/digital/lec_9_4.jpg new file mode 100644 index 00000000..6f7c88cf Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_4.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_5.jpg b/blitherboom-blog/pages/images/digital/lec_9_5.jpg new file mode 100644 index 00000000..df64324c Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_5.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_6.jpg b/blitherboom-blog/pages/images/digital/lec_9_6.jpg new file mode 100644 index 00000000..769a7adc Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_6.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_7.jpg b/blitherboom-blog/pages/images/digital/lec_9_7.jpg new file mode 100644 index 00000000..57eb6072 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_7.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_8.jpg b/blitherboom-blog/pages/images/digital/lec_9_8.jpg new file mode 100644 index 00000000..5685011d Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_8.jpg differ diff --git a/blitherboom-blog/pages/images/digital/lec_9_9.jpg b/blitherboom-blog/pages/images/digital/lec_9_9.jpg new file mode 100644 index 00000000..7591c893 Binary files /dev/null and b/blitherboom-blog/pages/images/digital/lec_9_9.jpg differ diff --git a/blitherboom-blog/pages/images/oj/1.jpg b/blitherboom-blog/pages/images/oj/1.jpg new file mode 100644 index 00000000..493ad46c Binary files /dev/null and b/blitherboom-blog/pages/images/oj/1.jpg differ diff --git a/blitherboom-blog/pages/images/pht.png b/blitherboom-blog/pages/images/pht.png new file mode 100644 index 00000000..565de72e Binary files /dev/null and b/blitherboom-blog/pages/images/pht.png differ diff --git a/blitherboom-blog/pages/images/physics/Exer9.29.jpg b/blitherboom-blog/pages/images/physics/Exer9.29.jpg new file mode 100644 index 00000000..fe93579f Binary files /dev/null and b/blitherboom-blog/pages/images/physics/Exer9.29.jpg differ diff --git a/blitherboom-blog/pages/images/physics/RealGasTemp.png b/blitherboom-blog/pages/images/physics/RealGasTemp.png new file mode 100644 index 00000000..8e18334a Binary files /dev/null and b/blitherboom-blog/pages/images/physics/RealGasTemp.png differ diff --git a/blitherboom-blog/pages/images/physics/STM.jpg b/blitherboom-blog/pages/images/physics/STM.jpg new file mode 100644 index 00000000..c98449d9 Binary files /dev/null and b/blitherboom-blog/pages/images/physics/STM.jpg differ diff --git a/blitherboom-blog/pages/images/physics/VanGas.png b/blitherboom-blog/pages/images/physics/VanGas.png new file mode 100644 index 00000000..babe0566 Binary files /dev/null and b/blitherboom-blog/pages/images/physics/VanGas.png differ diff --git a/blitherboom-blog/pages/images/physics/VanGasTemp.png b/blitherboom-blog/pages/images/physics/VanGasTemp.png new file mode 100644 index 00000000..ecb33ada Binary files /dev/null and b/blitherboom-blog/pages/images/physics/VanGasTemp.png differ diff --git a/blitherboom-blog/pages/images/physics/abaaba.jpg b/blitherboom-blog/pages/images/physics/abaaba.jpg new file mode 100644 index 00000000..b2f24d75 Binary files /dev/null and b/blitherboom-blog/pages/images/physics/abaaba.jpg differ diff --git a/blitherboom-blog/pages/images/physics/guocheng.png b/blitherboom-blog/pages/images/physics/guocheng.png new file mode 100644 index 00000000..30afedf0 Binary files /dev/null and b/blitherboom-blog/pages/images/physics/guocheng.png differ diff --git a/blitherboom-blog/pages/images/physics/niudunhuan.jpg b/blitherboom-blog/pages/images/physics/niudunhuan.jpg new file mode 100644 index 00000000..41e24627 Binary files /dev/null and b/blitherboom-blog/pages/images/physics/niudunhuan.jpg differ diff --git a/blitherboom-blog/pages/images/physics/rexunhuan.png b/blitherboom-blog/pages/images/physics/rexunhuan.png new file mode 100644 index 00000000..898cc0ad Binary files /dev/null and b/blitherboom-blog/pages/images/physics/rexunhuan.png differ diff --git a/blitherboom-blog/pages/images/physics/shuangfeng.jpg b/blitherboom-blog/pages/images/physics/shuangfeng.jpg new file mode 100644 index 00000000..996a1eb2 Binary files /dev/null and b/blitherboom-blog/pages/images/physics/shuangfeng.jpg differ diff --git a/blitherboom-blog/pages/images/physics/shuangzheshe.jpg b/blitherboom-blog/pages/images/physics/shuangzheshe.jpg new file mode 100644 index 00000000..0d1a8eea Binary files /dev/null and b/blitherboom-blog/pages/images/physics/shuangzheshe.jpg differ diff --git a/blitherboom-blog/pages/images/physics/xunhuantu.png b/blitherboom-blog/pages/images/physics/xunhuantu.png new file mode 100644 index 00000000..819cca8a Binary files /dev/null and b/blitherboom-blog/pages/images/physics/xunhuantu.png differ diff --git a/blitherboom-blog/pages/images/physics/zhilengxunhuan.png b/blitherboom-blog/pages/images/physics/zhilengxunhuan.png new file mode 100644 index 00000000..e0e89338 Binary files /dev/null and b/blitherboom-blog/pages/images/physics/zhilengxunhuan.png differ diff --git "a/blitherboom-blog/pages/images/physics/\345\207\206\345\215\225\350\211\262\345\205\211.jpg" "b/blitherboom-blog/pages/images/physics/\345\207\206\345\215\225\350\211\262\345\205\211.jpg" new file mode 100644 index 00000000..9eaf91b2 Binary files /dev/null and "b/blitherboom-blog/pages/images/physics/\345\207\206\345\215\225\350\211\262\345\205\211.jpg" differ diff --git "a/blitherboom-blog/pages/images/physics/\351\235\236\345\215\225\350\211\262\345\205\211.jpg" "b/blitherboom-blog/pages/images/physics/\351\235\236\345\215\225\350\211\262\345\205\211.jpg" new file mode 100644 index 00000000..4b4fecac Binary files /dev/null and "b/blitherboom-blog/pages/images/physics/\351\235\236\345\215\225\350\211\262\345\205\211.jpg" differ diff --git a/blitherboom-blog/pages/images/prob/L14_1.jpg b/blitherboom-blog/pages/images/prob/L14_1.jpg new file mode 100644 index 00000000..bfa2030a Binary files /dev/null and b/blitherboom-blog/pages/images/prob/L14_1.jpg differ diff --git a/blitherboom-blog/pages/images/prob/L15_1.jpg b/blitherboom-blog/pages/images/prob/L15_1.jpg new file mode 100644 index 00000000..8e54be0b Binary files /dev/null and b/blitherboom-blog/pages/images/prob/L15_1.jpg differ diff --git a/blitherboom-blog/pages/images/prob/L2_1.jpg b/blitherboom-blog/pages/images/prob/L2_1.jpg new file mode 100644 index 00000000..208bf398 Binary files /dev/null and b/blitherboom-blog/pages/images/prob/L2_1.jpg differ diff --git a/blitherboom-blog/pages/images/prob/L6_1.jpg b/blitherboom-blog/pages/images/prob/L6_1.jpg new file mode 100644 index 00000000..bd5f5343 Binary files /dev/null and b/blitherboom-blog/pages/images/prob/L6_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec10_1.jpg b/blitherboom-blog/pages/images/ss/lec10_1.jpg new file mode 100644 index 00000000..7da9f8b7 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec10_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec10_2.jpg b/blitherboom-blog/pages/images/ss/lec10_2.jpg new file mode 100644 index 00000000..a7defab4 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec10_2.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec10_3.jpg b/blitherboom-blog/pages/images/ss/lec10_3.jpg new file mode 100644 index 00000000..3549f584 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec10_3.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec10_4.jpg b/blitherboom-blog/pages/images/ss/lec10_4.jpg new file mode 100644 index 00000000..aa7f67fb Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec10_4.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec10_5.jpg b/blitherboom-blog/pages/images/ss/lec10_5.jpg new file mode 100644 index 00000000..a3876eb5 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec10_5.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec10_6.jpg b/blitherboom-blog/pages/images/ss/lec10_6.jpg new file mode 100644 index 00000000..d3461561 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec10_6.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec10_7.jpg b/blitherboom-blog/pages/images/ss/lec10_7.jpg new file mode 100644 index 00000000..61ba3829 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec10_7.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec10_8.jpg b/blitherboom-blog/pages/images/ss/lec10_8.jpg new file mode 100644 index 00000000..795c14b6 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec10_8.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec11_1.jpg b/blitherboom-blog/pages/images/ss/lec11_1.jpg new file mode 100644 index 00000000..bd7c1038 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec11_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec11_2.jpg b/blitherboom-blog/pages/images/ss/lec11_2.jpg new file mode 100644 index 00000000..6a865f4a Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec11_2.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec11_3.jpg b/blitherboom-blog/pages/images/ss/lec11_3.jpg new file mode 100644 index 00000000..b6ac431c Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec11_3.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec12_1.jpg b/blitherboom-blog/pages/images/ss/lec12_1.jpg new file mode 100644 index 00000000..6bccaba1 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec12_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec12_2.jpg b/blitherboom-blog/pages/images/ss/lec12_2.jpg new file mode 100644 index 00000000..f4c767de Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec12_2.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec12_3.jpg b/blitherboom-blog/pages/images/ss/lec12_3.jpg new file mode 100644 index 00000000..b93e236c Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec12_3.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec12_4.jpg b/blitherboom-blog/pages/images/ss/lec12_4.jpg new file mode 100644 index 00000000..5cf77423 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec12_4.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec12_5.jpg b/blitherboom-blog/pages/images/ss/lec12_5.jpg new file mode 100644 index 00000000..51572c70 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec12_5.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec12_6.jpg b/blitherboom-blog/pages/images/ss/lec12_6.jpg new file mode 100644 index 00000000..bbbbe70d Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec12_6.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec12_7.jpg b/blitherboom-blog/pages/images/ss/lec12_7.jpg new file mode 100644 index 00000000..e5d2043e Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec12_7.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec12_8.jpg b/blitherboom-blog/pages/images/ss/lec12_8.jpg new file mode 100644 index 00000000..66cf3fb5 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec12_8.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec13_1.jpg b/blitherboom-blog/pages/images/ss/lec13_1.jpg new file mode 100644 index 00000000..9e523f2f Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec13_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec14_1.jpg b/blitherboom-blog/pages/images/ss/lec14_1.jpg new file mode 100644 index 00000000..1410b99d Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec14_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec14_2.jpg b/blitherboom-blog/pages/images/ss/lec14_2.jpg new file mode 100644 index 00000000..bbc017ab Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec14_2.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec14_3.jpg b/blitherboom-blog/pages/images/ss/lec14_3.jpg new file mode 100644 index 00000000..6d2ee400 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec14_3.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec14_4.jpg b/blitherboom-blog/pages/images/ss/lec14_4.jpg new file mode 100644 index 00000000..5e42f889 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec14_4.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec14_5.jpg b/blitherboom-blog/pages/images/ss/lec14_5.jpg new file mode 100644 index 00000000..737acbcc Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec14_5.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec14_6.jpg b/blitherboom-blog/pages/images/ss/lec14_6.jpg new file mode 100644 index 00000000..31bc0a4b Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec14_6.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec14_7.jpg b/blitherboom-blog/pages/images/ss/lec14_7.jpg new file mode 100644 index 00000000..a9919a54 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec14_7.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec15_1.jpg b/blitherboom-blog/pages/images/ss/lec15_1.jpg new file mode 100644 index 00000000..7113a24f Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec15_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec15_2.jpg b/blitherboom-blog/pages/images/ss/lec15_2.jpg new file mode 100644 index 00000000..b1b17fe7 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec15_2.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec15_3.jpg b/blitherboom-blog/pages/images/ss/lec15_3.jpg new file mode 100644 index 00000000..ee2997ec Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec15_3.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec15_4.jpg b/blitherboom-blog/pages/images/ss/lec15_4.jpg new file mode 100644 index 00000000..a3c22657 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec15_4.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec15_5.jpg b/blitherboom-blog/pages/images/ss/lec15_5.jpg new file mode 100644 index 00000000..36353287 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec15_5.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec15_6.jpg b/blitherboom-blog/pages/images/ss/lec15_6.jpg new file mode 100644 index 00000000..92eecd31 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec15_6.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec16_.jpg b/blitherboom-blog/pages/images/ss/lec16_.jpg new file mode 100644 index 00000000..cfb43bc0 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec16_.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec16_1.jpg b/blitherboom-blog/pages/images/ss/lec16_1.jpg new file mode 100644 index 00000000..c7e7b49b Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec16_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec16_2.jpg b/blitherboom-blog/pages/images/ss/lec16_2.jpg new file mode 100644 index 00000000..22e8501b Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec16_2.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec16_3.jpg b/blitherboom-blog/pages/images/ss/lec16_3.jpg new file mode 100644 index 00000000..37f43486 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec16_3.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec16_4.jpg b/blitherboom-blog/pages/images/ss/lec16_4.jpg new file mode 100644 index 00000000..141a9325 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec16_4.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec17_1.jpg b/blitherboom-blog/pages/images/ss/lec17_1.jpg new file mode 100644 index 00000000..8521e216 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec17_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec18_1.jpg b/blitherboom-blog/pages/images/ss/lec18_1.jpg new file mode 100644 index 00000000..cc218e4e Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec18_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec18_2.jpg b/blitherboom-blog/pages/images/ss/lec18_2.jpg new file mode 100644 index 00000000..e3540cb6 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec18_2.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec18_3.jpg b/blitherboom-blog/pages/images/ss/lec18_3.jpg new file mode 100644 index 00000000..dd46590e Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec18_3.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec18_34jpg.jpg b/blitherboom-blog/pages/images/ss/lec18_34jpg.jpg new file mode 100644 index 00000000..9f0dcba2 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec18_34jpg.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec18_5jpg.jpg b/blitherboom-blog/pages/images/ss/lec18_5jpg.jpg new file mode 100644 index 00000000..f510aff1 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec18_5jpg.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec18_6.jpg b/blitherboom-blog/pages/images/ss/lec18_6.jpg new file mode 100644 index 00000000..e93ff44f Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec18_6.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec19_1jpg.jpg b/blitherboom-blog/pages/images/ss/lec19_1jpg.jpg new file mode 100644 index 00000000..939ef8a2 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec19_1jpg.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec19_2jpg.jpg b/blitherboom-blog/pages/images/ss/lec19_2jpg.jpg new file mode 100644 index 00000000..4f928e5c Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec19_2jpg.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec19_3.jpg b/blitherboom-blog/pages/images/ss/lec19_3.jpg new file mode 100644 index 00000000..3cdaef4a Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec19_3.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec20_1.jpg b/blitherboom-blog/pages/images/ss/lec20_1.jpg new file mode 100644 index 00000000..c33f97c0 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec20_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec20_2.jpg b/blitherboom-blog/pages/images/ss/lec20_2.jpg new file mode 100644 index 00000000..a1bcea06 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec20_2.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec20_3.jpg b/blitherboom-blog/pages/images/ss/lec20_3.jpg new file mode 100644 index 00000000..b7fb3a1a Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec20_3.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec20_4.jpg b/blitherboom-blog/pages/images/ss/lec20_4.jpg new file mode 100644 index 00000000..fd3ee975 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec20_4.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec20_5.jpg b/blitherboom-blog/pages/images/ss/lec20_5.jpg new file mode 100644 index 00000000..04d62145 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec20_5.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec20_6.jpg b/blitherboom-blog/pages/images/ss/lec20_6.jpg new file mode 100644 index 00000000..f9bfc32d Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec20_6.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec20_7.jpg b/blitherboom-blog/pages/images/ss/lec20_7.jpg new file mode 100644 index 00000000..eec963d4 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec20_7.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec20_8.jpg b/blitherboom-blog/pages/images/ss/lec20_8.jpg new file mode 100644 index 00000000..f0d4beeb Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec20_8.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec21_1.jpg b/blitherboom-blog/pages/images/ss/lec21_1.jpg new file mode 100644 index 00000000..c50820fd Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec21_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec21_10.jpg b/blitherboom-blog/pages/images/ss/lec21_10.jpg new file mode 100644 index 00000000..7e4077ba Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec21_10.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec21_2.jpg b/blitherboom-blog/pages/images/ss/lec21_2.jpg new file mode 100644 index 00000000..79be57de Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec21_2.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec21_3.jpg b/blitherboom-blog/pages/images/ss/lec21_3.jpg new file mode 100644 index 00000000..54221092 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec21_3.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec21_4.jpg b/blitherboom-blog/pages/images/ss/lec21_4.jpg new file mode 100644 index 00000000..ee8f481b Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec21_4.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec21_5.jpg b/blitherboom-blog/pages/images/ss/lec21_5.jpg new file mode 100644 index 00000000..9e688522 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec21_5.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec21_6.jpg b/blitherboom-blog/pages/images/ss/lec21_6.jpg new file mode 100644 index 00000000..3800b1c4 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec21_6.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec21_7.jpg b/blitherboom-blog/pages/images/ss/lec21_7.jpg new file mode 100644 index 00000000..cb366249 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec21_7.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec21_8.jpg b/blitherboom-blog/pages/images/ss/lec21_8.jpg new file mode 100644 index 00000000..ee07f3e2 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec21_8.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec21_9.jpg b/blitherboom-blog/pages/images/ss/lec21_9.jpg new file mode 100644 index 00000000..cb366249 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec21_9.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec22_11.jpg b/blitherboom-blog/pages/images/ss/lec22_11.jpg new file mode 100644 index 00000000..fafe28c3 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec22_11.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec22_12.jpg b/blitherboom-blog/pages/images/ss/lec22_12.jpg new file mode 100644 index 00000000..10f4157f Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec22_12.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec22_13.jpg b/blitherboom-blog/pages/images/ss/lec22_13.jpg new file mode 100644 index 00000000..86acf9c3 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec22_13.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec22_14.jpg b/blitherboom-blog/pages/images/ss/lec22_14.jpg new file mode 100644 index 00000000..01eceaac Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec22_14.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec22_15.jpg b/blitherboom-blog/pages/images/ss/lec22_15.jpg new file mode 100644 index 00000000..c499759b Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec22_15.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec22_16.jpg b/blitherboom-blog/pages/images/ss/lec22_16.jpg new file mode 100644 index 00000000..25d3da08 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec22_16.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec22_17.jpg b/blitherboom-blog/pages/images/ss/lec22_17.jpg new file mode 100644 index 00000000..f14447c7 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec22_17.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec22_18.jpg b/blitherboom-blog/pages/images/ss/lec22_18.jpg new file mode 100644 index 00000000..a61cbd5c Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec22_18.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec22_19.jpg b/blitherboom-blog/pages/images/ss/lec22_19.jpg new file mode 100644 index 00000000..f74b0e6e Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec22_19.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec22_20.jpg b/blitherboom-blog/pages/images/ss/lec22_20.jpg new file mode 100644 index 00000000..13dd3278 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec22_20.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec23_1.jpg b/blitherboom-blog/pages/images/ss/lec23_1.jpg new file mode 100644 index 00000000..d0f073f4 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec23_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec2_.jpg b/blitherboom-blog/pages/images/ss/lec2_.jpg new file mode 100644 index 00000000..5b0a5e51 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec2_.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec2_2.jpg b/blitherboom-blog/pages/images/ss/lec2_2.jpg new file mode 100644 index 00000000..e28485ca Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec2_2.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec2_3.jpg b/blitherboom-blog/pages/images/ss/lec2_3.jpg new file mode 100644 index 00000000..b3d71344 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec2_3.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec3_1.jpg b/blitherboom-blog/pages/images/ss/lec3_1.jpg new file mode 100644 index 00000000..cb5b84c2 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec3_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec3_2.jpg b/blitherboom-blog/pages/images/ss/lec3_2.jpg new file mode 100644 index 00000000..1f2ea493 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec3_2.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec7_1.jpg b/blitherboom-blog/pages/images/ss/lec7_1.jpg new file mode 100644 index 00000000..c0820748 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec7_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec7_2.jpg b/blitherboom-blog/pages/images/ss/lec7_2.jpg new file mode 100644 index 00000000..73f4d691 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec7_2.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec7_3.jpg b/blitherboom-blog/pages/images/ss/lec7_3.jpg new file mode 100644 index 00000000..b08c8dc5 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec7_3.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec7_4.jpg b/blitherboom-blog/pages/images/ss/lec7_4.jpg new file mode 100644 index 00000000..71c5c1f1 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec7_4.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec9_1.jpg b/blitherboom-blog/pages/images/ss/lec9_1.jpg new file mode 100644 index 00000000..f78e1b07 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec9_1.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec9_2.jpg b/blitherboom-blog/pages/images/ss/lec9_2.jpg new file mode 100644 index 00000000..1f4347ef Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec9_2.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec9_3.jpg b/blitherboom-blog/pages/images/ss/lec9_3.jpg new file mode 100644 index 00000000..639b7380 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec9_3.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec9_4.jpg b/blitherboom-blog/pages/images/ss/lec9_4.jpg new file mode 100644 index 00000000..9ed713f8 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec9_4.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec9_5.jpg b/blitherboom-blog/pages/images/ss/lec9_5.jpg new file mode 100644 index 00000000..7a12ffb0 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec9_5.jpg differ diff --git a/blitherboom-blog/pages/images/ss/lec9_6.jpg b/blitherboom-blog/pages/images/ss/lec9_6.jpg new file mode 100644 index 00000000..863d67b4 Binary files /dev/null and b/blitherboom-blog/pages/images/ss/lec9_6.jpg differ diff --git a/blitherboom-blog/pages/images/stochastic/exer_1.jpg b/blitherboom-blog/pages/images/stochastic/exer_1.jpg new file mode 100644 index 00000000..56e7c6f6 Binary files /dev/null and b/blitherboom-blog/pages/images/stochastic/exer_1.jpg differ diff --git "a/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_1.jpg" "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_1.jpg" new file mode 100644 index 00000000..99e94d52 Binary files /dev/null and "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_1.jpg" differ diff --git "a/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_2.jpg" "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_2.jpg" new file mode 100644 index 00000000..0d13b0a4 Binary files /dev/null and "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_2.jpg" differ diff --git "a/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_3.jpg" "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_3.jpg" new file mode 100644 index 00000000..b26d0981 Binary files /dev/null and "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_3.jpg" differ diff --git "a/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_4.jpg" "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_4.jpg" new file mode 100644 index 00000000..ca813eb4 Binary files /dev/null and "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_4.jpg" differ diff --git "a/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_5.jpg" "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_5.jpg" new file mode 100644 index 00000000..41c2baef Binary files /dev/null and "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_5.jpg" differ diff --git "a/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_6.jpg" "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_6.jpg" new file mode 100644 index 00000000..ac397c6c Binary files /dev/null and "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_6.jpg" differ diff --git "a/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_7.jpg" "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_7.jpg" new file mode 100644 index 00000000..c1f92714 Binary files /dev/null and "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/3_7.jpg" differ diff --git "a/blitherboom-blog/pages/images/\350\256\241\347\275\221/5_1.jpg" "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/5_1.jpg" new file mode 100644 index 00000000..96e0242a Binary files /dev/null and "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/5_1.jpg" differ diff --git "a/blitherboom-blog/pages/images/\350\256\241\347\275\221/5_2.jpg" "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/5_2.jpg" new file mode 100644 index 00000000..542db0ee Binary files /dev/null and "b/blitherboom-blog/pages/images/\350\256\241\347\275\221/5_2.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/1_.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/1_.jpg" new file mode 100644 index 00000000..cdc921f4 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/1_.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/1_1.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/1_1.jpg" new file mode 100644 index 00000000..60454c36 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/1_1.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_1.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_1.jpg" new file mode 100644 index 00000000..44b8332d Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_1.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_2.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_2.jpg" new file mode 100644 index 00000000..c9984a64 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_2.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_3.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_3.jpg" new file mode 100644 index 00000000..2e7941f8 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_3.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_4.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_4.jpg" new file mode 100644 index 00000000..48d25941 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_4.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_5.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_5.jpg" new file mode 100644 index 00000000..8a04cbf5 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_5.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_6.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_6.jpg" new file mode 100644 index 00000000..6a14dbc2 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_6.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_7.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_7.jpg" new file mode 100644 index 00000000..15067e01 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_7.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_8.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_8.jpg" new file mode 100644 index 00000000..a7ad4613 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_8.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_9.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_9.jpg" new file mode 100644 index 00000000..c20818df Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/2_9.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_1.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_1.jpg" new file mode 100644 index 00000000..47e3ab37 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_1.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_2.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_2.jpg" new file mode 100644 index 00000000..d8869f60 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_2.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_3.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_3.jpg" new file mode 100644 index 00000000..27e08fe6 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_3.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_4.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_4.jpg" new file mode 100644 index 00000000..eb14d4b4 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_4.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_5.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_5.jpg" new file mode 100644 index 00000000..9c63f037 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_5.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_6.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_6.jpg" new file mode 100644 index 00000000..7fd432be Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/3_6.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_1.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_1.jpg" new file mode 100644 index 00000000..c377e56c Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_1.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_10.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_10.jpg" new file mode 100644 index 00000000..466c0a44 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_10.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_2.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_2.jpg" new file mode 100644 index 00000000..37e84594 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_2.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_3.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_3.jpg" new file mode 100644 index 00000000..ade87d06 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_3.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_4.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_4.jpg" new file mode 100644 index 00000000..1c9e6a0d Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_4.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_5.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_5.jpg" new file mode 100644 index 00000000..dd5b1a3f Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_5.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_6.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_6.jpg" new file mode 100644 index 00000000..3a02e86d Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_6.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_7.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_7.jpg" new file mode 100644 index 00000000..fada1fc2 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_7.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_8.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_8.jpg" new file mode 100644 index 00000000..14b38575 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_8.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_9.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_9.jpg" new file mode 100644 index 00000000..2901f73e Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/4_9.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_1.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_1.jpg" new file mode 100644 index 00000000..7f1816a1 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_1.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_10.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_10.jpg" new file mode 100644 index 00000000..95fd875e Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_10.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_2.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_2.jpg" new file mode 100644 index 00000000..38d12268 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_2.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_3.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_3.jpg" new file mode 100644 index 00000000..76b046c8 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_3.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_4.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_4.jpg" new file mode 100644 index 00000000..e4af88f5 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_4.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_5.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_5.jpg" new file mode 100644 index 00000000..0dd2d108 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_5.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_6.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_6.jpg" new file mode 100644 index 00000000..49c133b0 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_6.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_7.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_7.jpg" new file mode 100644 index 00000000..09d90ee5 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_7.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_8.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_8.jpg" new file mode 100644 index 00000000..bc7e8177 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_8.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_9.jpg" "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_9.jpg" new file mode 100644 index 00000000..51f3dcd0 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\200\232\347\275\221/5_9.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\207\217\347\255\222/4_2.jpg" "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/4_2.jpg" new file mode 100644 index 00000000..45b631f5 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/4_2.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\207\217\347\255\222/4\342\200\224\342\200\2241.jpg" "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/4\342\200\224\342\200\2241.jpg" new file mode 100644 index 00000000..6e73ec61 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/4\342\200\224\342\200\2241.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\207\217\347\255\222/5_1.jpg" "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/5_1.jpg" new file mode 100644 index 00000000..cb52a36d Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/5_1.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\207\217\347\255\222/7_1.jpg" "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/7_1.jpg" new file mode 100644 index 00000000..4d41ba5a Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/7_1.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\207\217\347\255\222/8_1.jpg" "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/8_1.jpg" new file mode 100644 index 00000000..5f26bd29 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/8_1.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\207\217\347\255\222/8_2.jpg" "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/8_2.jpg" new file mode 100644 index 00000000..6485a786 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/8_2.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\207\217\347\255\222/8_3.jpg" "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/8_3.jpg" new file mode 100644 index 00000000..7f08ddfa Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/8_3.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\207\217\347\255\222/8_4.jpg" "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/8_4.jpg" new file mode 100644 index 00000000..00471a77 Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/8_4.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\207\217\347\255\222/xt_2_1.jpg" "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/xt_2_1.jpg" new file mode 100644 index 00000000..764389bb Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/xt_2_1.jpg" differ diff --git "a/blitherboom-blog/pages/images/\351\207\217\347\255\222/xt_2_2.jpg" "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/xt_2_2.jpg" new file mode 100644 index 00000000..0dc2709c Binary files /dev/null and "b/blitherboom-blog/pages/images/\351\207\217\347\255\222/xt_2_2.jpg" differ diff --git a/blitherboom-blog/pages/links/index.md b/blitherboom-blog/pages/links/index.md new file mode 100644 index 00000000..6f582af9 --- /dev/null +++ b/blitherboom-blog/pages/links/index.md @@ -0,0 +1,9 @@ +--- +title: 我的小伙伴们 +keywords: 链接 +description: 云游的小伙伴们 +links: https://www.yunyoujun.cn/friends/links.json +random: true +--- + + diff --git a/blitherboom-blog/pages/posts/AI.md b/blitherboom-blog/pages/posts/AI.md new file mode 100644 index 00000000..1733dd81 --- /dev/null +++ b/blitherboom-blog/pages/posts/AI.md @@ -0,0 +1,7 @@ +--- +title: Introduction to Artificial Intelligence +katex: false +date: 2024-02-26 15:20:37 +tags: +--- + diff --git a/blitherboom-blog/pages/posts/Antenna.md b/blitherboom-blog/pages/posts/Antenna.md new file mode 100644 index 00000000..e6ce3cb4 --- /dev/null +++ b/blitherboom-blog/pages/posts/Antenna.md @@ -0,0 +1,262 @@ +--- +title: Principle of Antenna +katex: true +date: 2024-03-01 14:14:50 +tags: +--- +## Introduction of Antenna + +Definition of Antenna + +* Transmitter and receiver of EM wave +* Signal from current to wave +* from lumped to distributed + +Antenna classifications + +* Resonant and non-resonant/leaky/travelling wave +* Antenna number: element, multiple antennas, array +* Shape: wire, loop, slot, patch/microstrip, cavity +* Materials: metallic, dielectric +* Property: wideband, narrow band +* Yagi-Uda, Vivaldi, Cassegrain +* Function: moblie/handset, base station, AiP + +## Maxwell equations + +$$ +\nabla \cdot \vec D = \rho \rightarrow \nabla \cdot \tilde{\vec D} = \rho \\ +\nabla \cdot {\vec B} = 0 \rarr \nabla \cdot \tilde{\vec B} = 0\\ +\nabla \times {\vec E} = -\frac{\partial \vec B}{\partial t} \rarr \nabla \times \tilde{\vec E} = -j\omega \tilde{\vec B}\\ +\nabla \times {\vec H} = \vec J + \frac{\partial \vec D}{\partial t} \rarr \nabla \times \tilde{\vec H} = \vec J + j\omega \tilde{\vec D}\\ +\vec D = \varepsilon \vec E\\ +\vec B = \mu \vec H +$$ + +$$ +\nabla^2 \vec F = \nabla(\nabla \cdot \vec F) - \nabla \times (\nabla \times \vec F)\\ +\nabla \times (\nabla f) = 0\\ +\nabla \cdot (\nabla \times \vec F) = 0 +$$ + +## Auxiliary Potential Functions + +Let + +$$ +\vec B = \nabla \times \vec A\\ +\vec E + j\omega \vec A = -\nabla \phi +$$ + +$$ +\nabla \cdot \vec D = \varepsilon \nabla \cdot(-\nabla \phi - j\omega \vec A) = \rho\\ +\Rightarrow \nabla^2\phi + \omega^2\mu\varepsilon\phi = - \frac{\rho}{\varepsilon} - j\omega(\nabla \cdot \vec A + j\omega \mu \varepsilon \phi) +$$ + +$$ +\nabla \times \vec H = \frac{1}{\mu}(\nabla(\nabla \cdot \vec A) - \nabla^2\vec A) = \vec J + j\omega \vec D = \vec J + j\omega\varepsilon(-\nabla\phi - j\omega \vec A)\\ +\Rightarrow \nabla^2\vec A + \omega^2\mu\varepsilon\vec A = -\mu \vec J - \nabla(\nabla \cdot \vec A + j\omega\mu\varepsilon\phi) +$$ + +Use Lorentz Gauge + +$$ +\nabla \cdot \vec A + j\omega\mu\varepsilon\phi = 0 +$$ + +Then + +$$ +\nabla^2\vec A + \omega^2\mu\varepsilon\vec A = -\mu \vec J\\ +\nabla^2\phi + \omega^2\mu\varepsilon\phi = - \frac{\rho}{\varepsilon} +$$ + +Solve ODE: + +$$ +\begin{equation} +\nabla^2\phi + k^2\phi = 0(r\ne 0) +\end{equation}\\ +\begin{equation} +\nabla^2\phi + k^2\phi = -\frac{\rho}{\varepsilon}(r=0) +\end{equation} +$$ + +For (1) + +$$ +u(r) = \frac{\phi(r)}{r}\\ +\frac{\rm{d}^2}{\rm{d}r^2}u + k^2u = 0\\ +u = C_1e^{-jkr} + C_2e^{jkr}\\ +\phi = C_1\frac{e^{-jkr}}{r} +$$ + +For (2), in arbitrary volume + +$$ +\iiint_V(\nabla^2\phi + k^2\phi)\mathrm dv = \iiint_V(-\frac{\rho}{\varepsilon}\mathrm dv) = -\frac{q}{\varepsilon}\\ +r \rightarrow 0\\ +\iiint_V(k^2\phi)\mathrm dv = 0\\ +\iiint_V\nabla^2\phi \mathrm dv = \oiint_S \nabla\phi \cdot \mathrm d\vec s = C_1 \oiint_S (\frac{-jkre^{-jkr} - e^{-jkr}}{r^2})\mathrm d\vec s = C_1 (\frac{-jkre^{-jkr} - e^{-jkr}}{r^2})4\pi r^2 = -C_1 4\pi +$$ + +Finally, + +$$ +\phi(r) = \frac{q}{4\pi\varepsilon}\frac{e^{-jkr}}{r} +$$ + +## Radiation Parameters + +### Field Zone + +Near field: resonant, field; + +Far field: propagation, wave; + +Fresnel region: transition; + +![1711090268476](../images/Antenna/1711090268476.png) + +### Antenna Parameters + +* Radiation patterns +* Radiation Intensity +* Power Density +* Directivity (方向性) and Gain (重要!) +* Polarization +* Effective Aperture(等效口面) and Aperture efficienty(口面效率) + +E 面:与电场方向平行的面 + +H 面:与磁场方向平行的面 + +#### Pattern Parameters + +![1711090565574](../images/Antenna/1711090565574.png) + +Often use log scale. + +#### Power Density + +Instantaneous Poynting vector $\vec S(x, y, z, t)$ + +Radiation Power Density = Time average Poynting vector $\vec S_{av}(x, y, z)=\frac1T\int_0^T\vec S(x, y, z, t)\mathrm dt = \frac12\text{Re}[\tilde{\vec E} \times \tilde{\vec H^*}]$ + +Total Radiation Power $P_{rad} = \oiint_S[\tilde{\vec E} \times \tilde{\vec H^*}] \cdot \mathrm d\vec s$ + +#### Radiation Intensity + +$$ +U(\theta, \varphi) = r^2 S(r, \theta, \varphi) +$$ + +Isotropic 各向同性 + +$$ +P_{rad} = \int_{0}^{2\pi}\int_{0}^{\pi}U\sin\theta\mathrm d\theta\mathrm d\varphi +$$ + +#### Directivity + +$$ +D = \frac{U_{\max}}{U_{av}} = \frac{P_{\max}}{P_{rad}/4\pi} +$$ + +![1711091202619](../images/Antenna/1711091202619.png) + +![1711091212947](../images/Antenna/1711091212947.png) + +![1711693683771](../images/Antenna/1711693683771.png) + +![1711693701192](../images/Antenna/1711693701192.png) + +#### Gain + +![1711693749686](../images/Antenna/1711693749686.png) + +$$ +G = \frac{U_{\max}}{P_{in}/4\pi} +$$ + +#### Polarization + +![1711693845822](../images/Antenna/1711693845822.png) + +Polarization Mismatch: + +![1711693861642](../images/Antenna/1711693861642.png) + +CP + +![1711693936592](../images/Antenna/1711693936592.png) + +#### Effective Aperture and Aperture efficiency + +![1711694027177](../images/Antenna/1711694027177.png) + +![1711694083583](../images/Antenna/1711694083583.png) + +### Circuit Parameters + +#### Input impedance + +Input impedance definition: + +* the impedance presented by an antenna at its terminals +* the ratio of the voltage to current at its terminals +* the ratio of the electric to magnetic fields at its terminals + +![1711694243897](../images/Antenna/1711694243897.png) + +##### Conjugate Matching + +$$ +Z_A = Z_g^* +$$ + +##### Mismatching + +![1711694350257](../images/Antenna/1711694350257.png) + +##### Radiation Resistance + +$$ +P_{rad} = \frac12|I_g|^2R_r = \oiint_S\vec S_{av} \cdot \rm d\vec s +$$ + +![1711694462059](../images/Antenna/1711694462059.png) + +#### Scattering Parameters + +![1711694619870](../images/Antenna/1711694619870.png) + +$$ +\frac{\Gamma^2}{Z_1} + \frac{T^2}{Z_2} = 1 +$$ + +![1711694639638](../images/Antenna/1711694639638.png) + +![1711695738159](../images/Antenna/1711695738159.png) + +二端口网络通常用于描述二天线问题。$S_{11}$表示天线1的反射,$S_{21}$表示天线1到天线2的耦合,均不利于信号的传播。我们希望让$1 - S_{11}^2 - S_{21}^2$尽可能大。 + +### Link Calculation + +#### Friis's Equation + +![1712471419276](../images/Antenna/1712471419276.png) + +![1712471436962](../images/Antenna/1712471436962.png) + +#### ERIP + +![1712471499226](../images/Antenna/1712471499226.png) + + + +赫兹偶极子的辐射电阻: $80\pi^2(\frac{\Delta z}{\lambda})^2$,方向性 $\frac{2}{3}$。 + +#### Radar Equation + +![1712473473687](../images/Antenna/1712473473687.png) diff --git "a/blitherboom-blog/pages/posts/CSAPP\345\255\246\344\271\240\347\254\224\350\256\260.md" "b/blitherboom-blog/pages/posts/CSAPP\345\255\246\344\271\240\347\254\224\350\256\260.md" new file mode 100644 index 00000000..2db2a032 --- /dev/null +++ "b/blitherboom-blog/pages/posts/CSAPP\345\255\246\344\271\240\347\254\224\350\256\260.md" @@ -0,0 +1,24 @@ +--- +title: CSAPP学习笔记 +date: 2023-01-21 11:19:14 +tags: +--- + + +### 第三章 + +CSAPP第三版使用的GCC版本:4.8.1 + +[Compiler Explorer](https://godbolt.org/) + +#### 为什么p173要执行subq $8, %rsp? +为了对齐栈指针。x86要求栈指针为16的倍数,而每次调用函数后栈指针模16都会余个8,两次push使栈指针减少16,还是余8. + +#### 随笔 + +结构体字节对齐的结论:对齐要求取决于占据空间最大的元素。可以先安排较大元素,再安排较小元素。 + +#### 答案纠错 +3.43第4问答案有误。应为```movq %rdi,(%rsi)```。 +![](../images/csapp1.jpg) + diff --git a/blitherboom-blog/pages/posts/Computer-Network.md b/blitherboom-blog/pages/posts/Computer-Network.md new file mode 100644 index 00000000..ff9e9f1d --- /dev/null +++ b/blitherboom-blog/pages/posts/Computer-Network.md @@ -0,0 +1,798 @@ +--- +title: Computer Network +date: 2023-09-18 19:18:41 +tags: note +katex: true +--- + +## 参考书籍 + +A.S Tanebaum (著),严伟,潘爱民(译) 计算机网络(第五版), 2004,清华大学出版社 + +A.S Tanebaum,Nick Feamster, David Wetherall (著),潘爱民(译), 计算机网络(第六版), 2022, 清华大学出版社(彩色版,非常精美) + + +## 杂项 + +token ring + +计算机网络最核心的技术:分组(packet)。 + +grid computing + +## 计算机网络的历史与进展 + +网络计算的基本模式 +* C/S or B/W +* P2P + +服务 +* 延迟、带宽、丢失率、可靠性 +* 单播/多播, 实时/非实时 + +链路:光纤、电缆和卫星 +* 电子、光子等作为传输介质 +* 节点:机械/电/光 + +协议 +* TCP/IP, ATM, MPLS, SONET, Ethernet, PPP, X.25, FrameRelay, AppleTalk, IPX, SNA + +功能 +* 路由,差错控制、拥塞控制、服务质量(QoS) + +应用:FTP、HTTP + + +空间距离 +* 局域网 (LAN): 以太网、令牌环、FDDI +* 城域网 (MAN): DQDB, SMDS ,以太网 +* 广域网 (WAN): X.25, ATM, frame relay, DWDM + +信息类型 +* 数据网络 vs. 通信网络 + +应用类型 +* 专用网络:飞机订票网,银行网,信用卡网 +* 通用网络:Internet + +使用权 +* 私有:企业网 +* 公用:电话网、Internet +协议的所有权 +* 私有: SNA (Systems Network Architecture) +* 开放: IP +技术 +* 地面 vs. 卫星 +* 有线 vs. 无线 +协议 +* IP, AppleTalk, SNA + +计算机网络的形成 +* 多终端系统 +* 把计算机互联起来 +1970年代的计算机网络 +* X.25 分组交换网:各国的电信部门建设运行 +* 各种专用的网络体系结构:SNA,DECnet +* Internet 的前身ARPANET进行实验运行 +1980年代的计算机网络 +* 标准化计算机网络体系结构:OSI +* 局域网络 LAN 技术空前发展 +* 建成NSFNET,Internet 初具规模 + +迈特卡尔夫定律(联网定律) + +网络价值随用户数平方成正比。未联网设备增加 $N$ 倍,效率增加 $N$ 倍。联网设备增加 $N$ 倍,效率增加 $N^2$ 倍 + +Internet 标准化组织 + +* Internet Engineering Task Force(IETF):IETF负责Internet协议的研发和改进。IETF被分为很多个工作组(working groups),他们提交的文档称为RFC(Request For Comments)。 +* IRTF(Internet Research Task Force):IRTF由一些专注于某个领域长期发展的研究小组组成。 +* Internet Architecture Board(IAB):IAB负责定义Internet的整体框架,为IETF提供大方向上的指导。 +* The Internet Engineering Steering Group(IESG):IESG在技术方面管理IETF的活动,负责Internet标准的制定过程。 + +所有的标准以RFC的形式发布出来,可以从www.ietf.org免费获得,但不是所有的RFC都是Internet标准。标准形成的一般步骤是: +* Internet Drafts +* RFCs +* Proposed Standard +* Draft Standard(需要两个可以工作的实现) +* Internet Standard(由IAB发布) + +David Clark, MIT, 1992: +* "We reject: kings, presidents, and voting. +* We believe in: rough consensus and running code.” + +**Paul Baran 分组交换网络** + +与 Donald Watts Davies 在这个思想的发明上有争议。 + +Baran 的设计细节: + +报文发送 +* 每个交换节点根据自己的路由表判断如何转发报文 +* 每个报文的转发都是独立于其他报文的 +* 交换节点不保存端节点的状态 + * 可扩展性好 + * 不是最有效的网络 + * 发送不是完美的 + * 端节点必须能容忍发送错误并从中恢复 +分布式系统 +* 所有交换节点是平等的 +* 避免了单一节点失效问题 +* 部件可以失效,但系统不可以 +* 系统的健壮性来自于 + * 足够的物理(硬件)冗余 + * 适应性路由 + +模拟实验表明:“extremely survivable networks can be built using a moderately low redundancy of connectivity level”—Paul Baran, 1964 + + +比较两种可靠系统的实现思路: + +电话系统 +* 笨终端,聪明的网络 +* 确保每个网络部件都是可靠的 + * 系统可靠性=部件可靠性 + * 通过局部冗余实现部件的高可靠性 + * 期望每个部件都能正常工作,部件失败的可能性很低 +* 需要人工配置的,高度控制的网络 + +Baran的系统 +* 建立在简单的、不可靠部件上的可靠系统 +* 自适应的系统 +* 聪明的终端,可以修正传输错误 + +Baran 设计思想的一种实现:Internet + +* 连接异构的子网 +* 提供两种基本功能 + * 全球唯一的地址 + * 报文通过动态路由从源节点发送到目的节点 + +simple, flexible, scalable, and robust + +分组交换的特点: + +**简单性** + +* 每个报文携带各自的地址信息 +* 一个路由表可以为所有的流量服务 +* 可以适应爆炸性的增长 + * 越简单越不容易出错 + * 越简单越容易增长 + * 对基本网络功能的要求少,可以在其上建立多种类型的网络 + +**灵活性** + +Everything over IP + +IP over Everything + +**可扩展性** + +可扩展的系统必须能对付 +* 端系统的增加 +* 流量的增加 +* 网络规模的增长 + * 大的路由表 + * 路由频繁的变化 + +边缘论:End-to-End Argument + +路由器只负责传输,复杂的功能(纠错,重传)都由终端自行解决 + +**健壮性** +* 动态路由具有自适应的特性 + * 动态路由和报文转发相辅相成 + * 周期性路由更新 + * 默认: 现有的部件会失效,会有新的部件加入,认为变化是正常的 +* 牺牲一定的带宽的利用率,提高健壮性(报文头开销,更新开销) + + +## 数据通信基本原理 + +香农定理: +带宽为 $H$ 赫兹,信噪比为 $S/N$ 的任意信道的最大数据传输率为 $H\log_2(1 + S/N) (bps)$ +* 此式是利用信息论得出的,具有普遍意义 +* 与信号电平级数、采样速度无关 +* 此式仅是上限,实践中难以达到 + +曼彻斯特码(Manchester),也称相位编码 +* 原理:每一位中间都有一个跳变,从低跳到高表示“0”,从高跳到低表示“1”。 +* 优点:克服了NRZ码的不足。每位中间的跳变即可作为数据,又可作为时钟,能够自同步。 + +差分曼彻斯特码(Differential Manchester) +* 原理:每一位中间都有一个跳变,每位开始时有跳变表示“0”,无跳变表示“1”。位中间跳变表示时钟,位前跳变表示数据。 +* 优点:时钟、数据分离,便于提取。 + +## 网络体系结构 + +### 计算机网络的构成 + +**资源子网** +* 服务器(Server) +* 客户机(Client) + +C/S -> B/W -> P2P + +**通信子网** +* 通信线路(通道) +* 网络互连设备(路由器、交换机、集线器等) + +#### 基本结构 + +**点到点通道** +* 一条线路连接两台网络互联设备 +* 一般两台计算机的连接要经过多台互联设备 +* 星形、环形、树形、全连结、交叉环、不规则图 +* 关键技术:路由选择(Routing) + +**广播网络** +* 总线,环 +* 组播网络(Multicast Networks):把成员分组 +* 单播网络(Unicast Networks) + * 点到点连接 +* 关键技术:通道分配 + * 静态分配:分时间片 + * 控制简单,通道利用率低 + * 动态分配各站点动态使用通道 + * 控制复杂,通道利用度高 + * 通道分配方法: + * 集中式:只有一个仲裁机构 + * 分布式:各站点均有仲裁机构 + +* PAN +* LAN +* MAN +* WAN +* internet,指一种技术(Internet,指实体的网络) +* Interplanetary Internet + +### 计算机网络体系结构 + +对计算机网络及其部件所完成的功能的比较精确的定义,即从功能的角度描述计算机网络的结构,是层次模型和协议的集合。 + +注意:计算机网络体系结构仅仅定义了网络及其部件通过协议应完成的功能,不定义协议的实现细节和各层协议之间的接口关系。 + +协议分层的优点:易于协议的设计、分析、实现和调试 + +计算机网络的功能: +* 基本功能:为地理位置不同的计算机用户提供访问通路 +* 具体化为: + * 连接源节点和目的节点的物理传输线路,可以经过中间节点 + * 每条线路两端的结点利用波形进行二进制通信 + * 无差错的信息传送 + * 多个用户共享一条物理线路 + * 按照地址信息,进行路由选择 + * 信息缓存与流量控制 + * 会话控制 + * 满足各种用户、各种应用的访问要求 + + +#### 网络协议 + +层次结构的计算计网络功能中最重要的功能是通信功能,这种通信功能主要涉及同层中通信双方的相互作用,位于不同计算机上进行对话的第N层通信各方可分别看成是一种进程,称为**对等进程(同等进程)** + +**协议** + +计算机网络同等层次中,通信双方进行信息交换时必须遵守的规则。 + +**协议栈** + +一个特定系统所使用的一组协议统称为协议栈。 + +**接口** + +相邻层之间有一个接口(Interface),它定义了下层向上层提供的原语操作与服务 + +#### 层、协议和接口 + +**协议特性** + +* 不知道上下层的内部结构 +* 独立完成某种功能 +* 为上层提供服务 +* 使用下层提供的服务 + +#### 服务分类 + +* 面向连接的服务 + * 当使用服务传输数据时,首先建立连接,然后使用该链接传送数据,使用完后,关闭连接。 + * 特点:顺序性好,类似于电话 +* 面向无连接的服务 + * 直接使用服务传送数据,每个分组独立进行路由选择。 + * 特点:顺序性差,类似于邮政 +* 连接与可靠的关系 + * 连接并不意味着可靠,可靠要通过确认、重传等机制来保证 + * 面向无连接的可以是可靠的,例如挂号信 + +TCP(可靠的连接),UDP(不可靠的) + +|服务|例子| +|--|--| +面向连接的例子| +|可靠的报文流|页面序列| +可靠的字节流|文件下载 +不可靠的连接|IP语音 +无连接的例子| +不可靠的数据报|垃圾邮件 +有确认的数据报|文本消息 +请求-响应|数据库查询 + +#### 服务原语(primitives) + +服务在形式上是由一组接口原语(或操作)来描述的 + +四种类型: + +* 请求(request):实体请求服务做一些工作 +* 指示(Indication):实体被通知事件的发生 +* 响应(Response):实体对某个事件的响应 +* 确认(Confirm):对较早请求产生响应的确认 + +#### 分层 + +引入中间层,为底层不同的网络技术提供统一的抽象,服务上层业务 + +### 计算机网络参考模型 + +#### 计算机网络的标准化 + +**电信标准** + +ITU(International Telecommunication Union) +* ITU-R:无线通信 +* ITU-T:电信标准 +* ITU-D:开发 + +**国际标准化组织:ISO** + +一个国际标准的形成: +* CD(Committee Draft) +* DIS(Draft International Standard) +* IS(International Standard) + +**其他标准化组织** + +* ANSI +* NIST +* IEEE +* OIF + +**互联网标准化组织** + +互联网标准是自发,而非政府干预的,标准文本称为 RFC(Request For Comments) + +#### OSI 参考模型 + +![alt](../images/计网/3_1.jpg) + +![alt](../images/计网/3_3.jpg) + +#### TCP/IP 参考模型 + +* 物理层 + * 在物理线路上传输原始的二进制位 +* 数据链路层 + * 在有差错的物理线路上提供无差错的数据传输 + * 第一层和第二层合称为:Host-to-Network +* Internet 层(网络层) + * 控制通信子网提供源点到目的点的IP分组传送 +* 运输层 + * 提供端到端的数据传送服务,包括 TCP 和 UDP +* 应用层 + * 提供各种管理和应用服务功能 + +![alt](../images/计网/3_2.jpg) + +#### 其他参考模型 + +Novell NetWare 参考模型 + +![alt](../images/计网/3_5.jpg) + +ATM 参考模型(B-ISDN) + +![alt](../images/计网/3_6.jpg) + +**排队与统计复用** + +若分组的到达速率超过链路的传输速率: + +* 分组在端口中排队,等待链路发送 +* 当排队等待的分组超过分配给端口队列的缓存大小,缓存溢出,导致新到达的分组被丢弃 +* 端口队列将随即到达的分组进行一定程度的整形,实现了关联端口链路的统计复用 + +**分组延时的组成** + +$$ +D = d_{proc} + d_{queue} + d_{trans} + d_{drop} +$$ + +$d_{trans}$:传输延时: +* L: 分组长度 +* R:链路速率 +* $d_{trans} = L / R$ + +$d_{prop}$ 传播延时: +* $d$:链路长度 +* $s$:传播速度 +* $d_{prop}$:$d/s$ + +**吞吐量** + +单位时间内发送者可以给接收者传送的比特数 +* 瞬时吞吐量:给定时刻的速率 +* 平均吞吐量:一段时间内的平均速率 + +瓶颈链路:端到端路径(Path)上约束端到端平均吞吐量的链路(Link) + + +![alt](../images/计网/3_7.jpg) + +**几个概念** + +* 报文:传输层协议的传输单位。报文由传输协议的头和应用层协议数据组成。就互联网而言,报文就是 TCP 报文段,报文段一定要封装在 IP 数据报(Datagram)中。 +* 报文段: TCP 协议端到端传输的单位。 +* IP 数据报分组:IP 协议的端到端传输单位,由 IP 头和传输层协议数据组成。 +* 分组:穿越网络层和链路层之间接口的数据单位。可以是完整的 IP 数据报或者 IP 数据报的分片(fragment) +* 帧:链路层协议传输单元 + +## 物理层 + +物理层提供机械的、电气的、功能的和规程的特性,目的是启动、维护和关闭数据链路实体之间进行比特传输的物理连接。这种连接可能通过中继系统,中继系统内的传输也是在物理层。 + +物理层的网络互联设备:中继器 + +物理层的基本功能:在两个网络设备之间提供透明的比特流传输。 + +物理层操作:物理连接的启动与关闭,正常数据的传输,以及维护管理。 + +* 连接方式 (点到点,点到多点) +* 通信方式 (单工,半双工,全双工) +* 位传输方式(串行,并行) + +物理层的四个重要特性: +* 机械特性 +* 电气特性 +* 功能特性 +* 规程特性 + +**机械特性** + +主要定义物理连接的边界点,即接插装置;规定物理连接时所采用的规格、引脚的数量和排列情况 + +**电气特性** + +规定传输二进制位时,线路上信号的电压高低、阻抗匹配、传输速率和距离限制。 + +**功能特性** + +主要定义各条物理线路的功能。 + +线路的功能分为四大类: +- 数据 +- 控制 +- 定时 +- 接地 + + +**规程特性** + +主要定义各条物理线路的工作规程和时序关系。 + +**传输介质** + +有导向介质 +* 铜线、光纤 + +磁介质 + +双绞线 + +同轴电缆 + +光纤 + +无导向介质 +* 无线电波、激光、红外等 + +**扩频技术** + +* 窄带通信 + * 窄带的接受效果更加 + * 利于提高单位 Hz 的能量 +* 扩频通信 + * 调频扩频 + * 直接序列扩频 + * 超宽带(UWB) + +无线电传输 + +低频率、大波长的无线电容易穿过障碍物。全方向发射。 + +微波传输 + +- f >100Mhz,波长在厘米级 +- 微波沿直线传播 +- 无法穿越障碍物,容易被雨水吸收 +- 多径衰落(Multipath fading) +- 造价低 + +红外线和毫米波 + +- 波长在毫米级 +- 很难穿越障碍物 +- 短程通信(无需授权) +- 遥控器等 +- 室内无线LAN + +光波传输 + +- 自由空间光通信 +- 无法穿透雨或浓雾 +- 受环境影响较大 + +**典型传输网络** + +* 电话网络 + * SONET/SDH + * 采用TDM技术,是同步系统,由主时钟控制,时钟精度10e-9。 + * 路径(path),链路(line),段(section) + +基本结构 +* 一帧包含 810 字节,每 125 us 产生一帧 +* 基本 SONET 信道称为 STS-1 + +蜂窝无线电(Cellular Radio) +* 单方向的寻呼系统 +* 打电话给寻呼公司,输入寻呼机号码; +* 寻呼公司的计算机收到请求,通过线路传到高处(山顶)的天线; +* 天线直接广播信号(本地寻呼),或传递给卫星(异地寻呼),卫星再广播。 +* 需要很小的带宽 + +模拟蜂窝电话 +* 使用小的蜂窝 +* 在附近(不相邻)的蜂窝中重用传输频率 +* 发射功率小,设备小而便宜 + +数字蜂窝网络 +* 第一代:模拟蜂窝电话 +* 第二代:数字蜂窝电话 +* 第三代:3G + +有线接入网络 + +通信卫星 + +电力线通信 + +## 数据链路层 + +### 定义和功能 + +数据链路层协议定义了一条链路的两个结点间交换数据的单元格式,以结点发送和接收数据单元的动作。 + +概念: + +结点(node):网络中的主机(host)和路由器(router)称为结点 + +链路(link): 通信路径上连接相邻结点的信道称为链路 + +点到点(point to point):一条链路的两个相邻结点间的通信称为点到点通信, 也称为通信路径(path)的一跳(hop) + +端到端(end to end) + +从源结点(source node)到目的结点(destination node)的通信称为端到端通信,通信路径可能由多个链路组成。 + +与端到端(end to end,E2E)相对应的概念是逐调(hop by hop,HBH) + +虚拟数据通路 + +实际数据通路 + +功能: + +数据链路层协议应提供的最基本功能 +- 向网络层提供服务 +- 定界与同步 +- 差错控制 +- 顺序控制 +- 流量控制 + +提供三种服务 +* 不可靠无连接服务 +* 可靠无连接服务 +* 可靠面向连接服务 + +#### 成帧 + +Framing: 将比特流分成离散的帧,并计算每个帧的校验和。 + +字符计数法 +* 在帧头中用一个域来表示整个帧的字符个数 +* 缺点:若计数出错,对本帧和后面的帧有影响 + +带字符填充的首尾字符定界法 +* 起始字符 DLE STX,结束字符DLE ETX + * DLE:Data Link Escape + * STX:Start of Text + * ETX:End of Text +* 字符填充 +* 局限于 8 位字符和 ASCII 字符传送 + + +带位填充的首尾标记定界法 +* 帧的起始和结束都用一个特殊的位串“01111110”,称为标记(flag) +* “0”比特插入删除技术 + +物理层编码违例法 + +只适用于物理层编码有冗余的网络 +* 802 LAN:曼彻斯特编码中 + * 高-低 / 低-高 分别表示1/0, + * 高-高 / 低-低 不表示数据,可以用来做定界符。 + +#### 差错控制 + +一般方法:接收方给发送方一个反馈(响应) + +出错情况 +* 帧出错,包括发送帧和相应帧 +* 帧丢失,包括发送帧和相应帧 + +一般方案 +* 通过计时器和序号保证每帧最终交给目的网络层仅一次 + +#### 流量控制 + +防止发送过快,淹没接收端 +* 例如,接收端缓存溢出 + +### 错误检测和纠正 + + 差错出现特点 +* 随机、偶发、孤立 +* 连续突发(burst) + 处理差错的两种基本策略 +* 使用纠错码 +* 发送方在每个数据块中加入足够的冗余信息,使得接收方能够判断接收到的数据是否有错,并能纠正错误。 + * 例:前向纠错FEC (Forward Error Correcting): +* 使用检错码 +* 发送方在每个数据块中加入足够的冗余信息,使得接收方能够判断接收到的数据是否有错,但不能判断哪里有错。 + +**奇偶校验** +最简单的例子是奇偶校验,在数据后填加一个奇偶位 + +奇偶校验可以用来检查奇数个错误 + +#### 纠错码 +码字(codeword) +* 一个帧包括m个数据位,r个校验位,n = m + r, +* 则此n比特单元称为n位码字 +海明距离(Hamming distance) +* 两个码字之间不同的比特位数目。 +* 例如:0000000000 与0000011111的海明距离为5 + +结论 +* 如果两个码字的海明距离为d,则需要d个单比特错就可以把一个码字转换成另一个码字; +* 为了检查出d个错,需要使用海明距离为 d + 1 的编码; +* 为了纠正d个错,需要使用海明距离为 2d + 1 的编码。 + +m个信息位,r个校验位,纠正单比特错 (n=r+m) + +对 $2^m$ 个任何有效信息中的任何一个,有 $n$ 个与其距离为 1 的无效码字,因此有 + +$$ +(n + 1)2^m \le 2^n +$$ + +利用 $n = m + r$,得到 $m + r + 1 \le 2^r$,给定 m,利用上式得到校正单比特误码的校验位数目下界 + +* 码位从左边开始编号,从“1”开始; +* 位号为2的幂的位是校验位,其余是信息位; +* 每个校验位使得包括自己在内的一些位的奇偶值为偶数(或奇数) +* 为看清数据位k对哪些校验位有影响,将k写成2的幂的和。 + +汉明码的工作过程: +* 每个码字到来前,接收方计数器清零; +* 接收方检查每个校验位k (k = 1, 2, 4 …)的奇偶值是否正确; +* 若第 k 位奇偶值不对,计数器加 k; +* 所有校验位检查完后,若计数器值为0,则码字有效;若计数器值为m,则第m位出错。例:若校验位1、2、8出错,则第11位变反。 + +#### 检错码 + +使用纠错码传数据,效率低。适用于不可重传的场合。 + +大多情况采用的检测码加重传。 + +二进制多项式 + +二进制码串表示成二进制多项式 + +循环冗余码(CRC) + +* 发送方与接收方事前商定。 +* 生成多项式的高位和低位必须为1 +* 生成多项式必须比传输信息对应的多项式短 + +CRC 的基本思想 +校验和(checksum)加载帧尾,使带校验和的帧的多项式能被 $G(x)$ 除尽,接收方接受时,用 $G(x)$ 去除它,若有余数,则传输出错。 + +校验和计算算法 + +设 $G(x)$ 为 $r$ 阶,在帧的末尾加 $r$ 个0,使得帧为 $m + r$ 位,相应多项式为 $x^rM(x)$。 + +按照模 2 除法用对应$G(x)$ 的位串去除对应于 $x^rM(x)$减去余数,结果就是要传送的带检验和的多项式 $T(x)$。 + +CRC 的检错能力: + +发送方发送 $T(x)$,接收方接受的$T(x) + E(x)$,$E(x) \ne 0$。 + +$(T(x) + E(x)) / G(x) = 0 + (E(x) / G(x))$ + +如果$(E(x) / G(x))$的余数为0,则差错不能发现;否则可以发现。 + +![alt](../images/计网/5_1.jpg) + +![alt](../images/计网/5_2.jpg) + +### 数据链路层协议 +#### 无约束单工协议 + +* 工作在理想情况 +* 单工传输 +* 发送方无休止工作(要发送的信息无限多) +* 接收方无休止工作(缓冲区无限大) +* 通信线路(信道)不损坏或丢失信息帧 + +工作过程 + +* 发送程序: 取数据,构成帧,发送帧; +* 接收程序: 等待,接收帧,送数据给高层 + +#### 单工停等协议 + +协议描述 +* 增加约束条件:接收方不能无休止接收。 +解决方案 +* 接收方每收到一个帧后,给发送方回送一个响应。 +工作过程 +* 发送程序:取数据,成帧,发送帧,等待响应帧 +* 接收程序:等待,接收帧,送数据给高层,回送响应帧。 + + +#### 有噪声信道的单工协议 + +协议描述 +* 增加约束条件:信道(线路)有差错,信息帧可能损坏或丢失。 + +解决方案 +* 出错重传 + * 带来的问题 + * 响应帧重复?发送帧头中放入序号 +* 重传触发: + * 超时重传 + * 什么时候重传?定时器 +ARQ/PAR + * PAR (Positive Acknowledgement with Retransmission) + * ARQ (Automatic Repeat reQuest) + +### 流量控制 + +#### 滑动窗口协议 + +捎带确认(piggybacking) + +**一位滑窗协议** +* 窗口大小:N = 1,发送序号和接收序号的取值范围:0,1; +* 可进行数据双向传输,信息帧中可含有确认信息(piggybacking); +* 信息帧中包括两个序号域:发送序号和接收序号 + (已经正确收到的帧的序号) +存在问题 +* 能保证无差错传输,但是基于停等方式; +* 若双方同时开始发送,则会有一半重复帧; +* 效率低,传输时间长。 + + +#### 退后n帧协议 +#### 选择重传协议 diff --git a/blitherboom-blog/pages/posts/DRL.md b/blitherboom-blog/pages/posts/DRL.md new file mode 100644 index 00000000..b7c95ded --- /dev/null +++ b/blitherboom-blog/pages/posts/DRL.md @@ -0,0 +1,130 @@ +--- +title: Deep Reinforcement Learning +katex: true +date: 2024-04-10 13:34:06 +tags: +--- +## Model-Based RL + +### Model-Based RL + +If we know the dynamics of some process: + +Objective in a Stochastic World + +The dynamics are stochastic + +The expectation under these actions in such a stochastic world. + +$$ +\begin{aligned}p_\theta(\mathbf{s}_1,\ldots,\mathbf{s}_T\mid\mathbf{a}_1,\ldots,\mathbf{a}_T)&=p(\mathbf{s}_1)\prod_{t=1}^Tp(\mathbf{s}_{t+1}\mid\mathbf{s}_t,\mathbf{a}_t)\\\mathbf{a}_1,\ldots,\mathbf{a}_T&=\arg\max_{\mathbf{a}_1,\ldots,\mathbf{a}_T}E\left[\sum_tr(\mathbf{s}_t,\mathbf{a}_t)\mid\mathbf{a}_1,\ldots,\mathbf{a}_T\right]\end{aligned} +$$ + +It is suboptimal. + +#### Open Loop Planning + +Guess and check (Random Shooting) + +* Pick action sequences uniformly in the action space +* Calculate the Result + +Better: Cross Entropy Method + +Example: MCTS + +#### Trajectory Optimization with Derivatives + +LQR? Linear Quadratic Regulator + +$$ +x_{t+1} = Ax_t+ Bu_t\\ +c(x_t, u_t) = x_t^TQx_t + u_t^TRu_t +$$ + + +The Q and R are symmetric and ponlositive definite. If not positive, you may optimize the result into negative inf. + + + +Value Iteration + +### Model-Free RL + +If the model is not known? + +modelbased RL: + +* base policy to collect dataset +* learning dynamics model from dataset +* plan through dynamics model and give actions +* Execute the actions and add the result into data set + +Model predictive control (MPC) + + +* base policy to collect dataset +* learning dynamics model from dataset +* plan through dynamics model and give actions +* only execute the first planned action +* append the $(s, a, s^\prime)$ to dataset + +### Model-based RL with a policy + +Why Model based RL with a learned model? + +* Data-efficiency + * Dont need to act in real world +* Multi-task with a model + * reuse the world model + +But they are unstable and worse asymptotic performance. +1. If the model biased toword the positive side + * the actions overfit to the learned model +2. if the trajectory is really long + * Accumulated errors + +To resolve 1: use uncertainty + +Optimize towards expectation of rewards rather than rewards + +Two types of uncertainty +* Aleatoric or statistical: The reality itself has uncertainty (e.g. Dice) +* Epistemic or model uncertainty: You are uncertain about the true function + +If use output entropy, it can't tell apart the type of uncertainty. We need to measure the epistemic uncertainty. + +How to measure? + +We use the collected data to train the model, maximize $\log(D|\theta)$ by changing $\theta$ + +Can we instead to measure $\log(\theta|D)$ -- the model uncertainty! + +but it is rather intractable. + +Model Ensemble! + +Training multiple models, see if they agree with each other. We have to make the models different(variant). + +The randomness and SGD is enough to make the models different. + +* Every time drag one model and give actions +* calculate the reward +* add the data into dataset and update policy + +To resolve 2 (long rollouts can be error-prone), we can always use short rollouts. + +combine the real and model data to improve policy + +Example: DYNA-style MBRL + +Also can try Baysian Neural Networks. + +### Value-Equivalent Model + +You dont have to stimulate the world, just simplify the value fuction ensuring to keep the value is approximately the same with the real one. + +Use mean square error. + +### Model-Base RL with images + diff --git a/blitherboom-blog/pages/posts/DataAndAlgorithms.md b/blitherboom-blog/pages/posts/DataAndAlgorithms.md new file mode 100644 index 00000000..a915d2bd --- /dev/null +++ b/blitherboom-blog/pages/posts/DataAndAlgorithms.md @@ -0,0 +1,1469 @@ +--- +title: 笔记-数据与算法 +date: 2022-09-13 10:01:08 +tags: note +katex: true +--- + +# 相关资源 + +[Princeton _Algorithm 4th Edition_](https://algs4.cs.princeton.edu/home/) + +# 课程说明 + +## 课程内容 + +数据处理,数学模型,算法分析 + +非数值问题: + +数据结构:线性表,栈,队列,串,树,图 + +非数值算法:查找,排序 + +数值问题: + +误差分析 + +线性方程组 + +非线性方程 + +拟合与插值 + +最优化初步 + +算法设计:蛮力,分治、减治、贪心、动态规划、搜索算法 + +# 绪论 + +## 数据与算法 + +## 数学模型 + +对于现实世界的某一特定对象,为特定目的而得到的一个抽象的简化的数学结构。 + +### 算法 + +算法是问题的程序化解决方案。 + +算法强调精确定义的求解过程,并不是问题的答案。 + +设计实现算法,并没有得到答案,但是给出了一般的解决方案。 + +一个算法能够解决很多看似好无关系的问题,只要这些问题可以抽象为某种相同的算法。 + +### 数据 + +数据是客观世界的描述。 + +数据是信息的载体,是算法处理的对象。 + +算法是处理数据的系统。 + +人的因素也被纳入了数学模型的和算法。 + +IBM Watson + +## 算法分析和算法设计 + +### 算法及其特性 + +算法的五个重要特性: + +有穷性:一个算法必须可以在有穷步之后结束,且每一步可以在有穷时间内完成 + +确定性:算法的描述无歧义,算法的执行结果是确定的且精确地符合要求或期望 + +可行性:算法中描述的操作都可以通过已经实现的基本操作运算的有限次执行来实现 + +输入:一个算法有零个或多个输入,这些输入取自某个特定的对象集 + +输出:一个算法有一个或多个输出,输出量是算法计算的结果 + +### 算法的评价 + +#### 正确性 + +不含语法错误 + +几组一般的输入数据 + +精心选择的、典型、苛刻且带有刁难性的输入数据(衡量标准) + +一切合法的输入数据 + +#### 健壮性 + +输入的数据非法 + +#### 可读性 + +描述清楚,便于理解 + +#### 高效率 + +占用的空间和时间资源 + +### 算法效率的衡量方法 + +和算法执行时间相关的因素有很多。 + +一个特定算法运行工作量的大小,是问题规模的函数。 + +#### 渐进时间复杂度 + +算法的渐进时间复杂度(Time Complexity): $T(n) = O[f(n)]$ + +Big-O 记号的形式化定义 + +- 若 f(n)是正整数 n 的一个函数,则$x_n = O[f(n)]$表示存在正的常数$M$和$n_0$, 使得当$n > n_0$时,都满足$|x_n| \le M|f(n)|$ +- 标记的是算法效率的上限 + +##### 算法效率估算方法 + +- 算法执行的时间 = Σ 操作的执行次数 × 操作的执行时间 +- 算法操作包括**控制操作**和**原操作**
一般来说,相比于循环体,控制操作本身的复杂度可被忽略。而在原操作中,我们又可以寻找其中执行次数最多的一种或几种操作,这些操作被称为基本操作。 +- 选取算法中的**基本操作** +- 算法的执行时间与**基本操作执行次数之和**成正比 + +##### 描述指标 + +- 最好情况(best-case):对于任何一个输入的运行时间下限 +- 最坏情况(worst-case):对于任何一个输入的运行时间下限 +- 平均(average-complexity): 根据各种操作出现概率的分布进行加权平均 +- 分摊(amortized complexity): 连续实施足够多次操作,总成本摊至单次操作 + +最重要的是平均情况下的性能 + +##### 引入大 O 表示的渐进时间复杂度和空间复杂度实际上是建立了算法效率分析的数学模型 + +##### 迅速找到会被多次反复执行的基本操作 + +##### 感兴趣的复杂度形式非常有限 + +##### 按照对数坐标画图 + +#### 空间复杂度 + +##### 算法空间 + +- 指令空间(instruction space): 用来存储程序指令所需的空间 +- 数据空间(data space): 存储运行过程中常量和变量所需的空间 +- 环境空间: 系统为程序运行,特别是函数调用提供的空间 + +##### 算法的渐进空间复杂度: $S(n) = O[f(n)]$ + +##### 输入数据所占空间只取决于问题本身,和算法无关,则只需要分析输入和程序之外的额外空间 + +### 数据结构 + +#### 数据元素和数据项 + +数据元素(Data Element): 数据的最小单位 + +数据项:(Data Item): 数据结构中讨论的最小单位 + +#### 数据结构是带结构的数据元素的集合 + +逻辑结构:集合,线性结构,树结构,图结构 + +存储结构:顺序存储,链式存储 + +#### 二元关系 + +##### 定义 + +定义:设有几何$M, N$, 其笛卡尔积$M \times N$的任意一个子集$R \in M \times N$ + +二元关系表示了集合$M$和集合$N$中元素之间的某种相关性。 + +若$(a, b) \in R$, 则称$a$为$R$的前件,$b$称为$R$的后件。 + +若$M = N$, 则称$R \sub M \times M$为 M 上的二元关系。 + +##### 二元关系的性质 + +设$R$为集合$M$上的一个二元关系: + +(1) 自反性:对于每个$a \in M$, 有 $(a, a) \in R$; + +反自反性: 对于所有$a \in M$, 有$(a, a) \notin R$; + +(2) 对称性:当$(a, b) \in R$时,则$a = b$; + +反对称性:当$(a, b) \in R$且$(b, a) \in R$时,必有$a = b$; + +(3) 传递性: 当$(a, b) \in R$且$(b, c) \in R$ 时, 必有$(a, c) \in R$。 + +##### 常见的二元关系 + +等价关系:满足自反性、对称性、传递性 + +偏序关系:满足自反性、反对称性、传递性 + +全序关系:若$M$中的任意两个元素$a$和$b$是可比的,也就是说或者有$aRb$成立,或者有$bRa$成立,则称$R$是集合$M$上的全序关系(Totala Order Relation) + +#### 数据类型(Data Type) + +##### C 语言中的类型定义 + +五种基本数据类型:字符型,整型,浮点型,双精度浮点型和无值类型 + +程序中任何变量,常量都必须先定义类型。 + +整数类型 int 及定义在其上的操作:+, -, \*, /, %, ++, -- + +双精度浮点型 double 及定义在其上的操作:+, -, \*, /, ++, -- + +###### 数据类型用来刻画(程序)操作对象的特性 + +数据类型是一个元素的集合和定义在此集合上的一组操作的总称。 + +数据类型实现了信息的隐藏,把一切用户无需了解的细节封装在类型中。 + +高级语言中的数据类型分为原子类型和结构类型。 + +#### 抽象数据类型(Abstract Data Type, ADT) + +是指一个数学模型以及定义在此数学模型上的一组操作。 + +数据抽象:描述的是实体的本质特征、功能以及外部用户接口 + +数据封装:将实体的外部特性和内在实现细节发呢里,对外部用户隐藏内部实现细节,使得应用和实现分离 + +ADT 的优点: + +- 程序结构清晰,易于扩展易于维护而不失其效率 +- 提高程序的数据安全性 +- 大大增加了软件的复用程度 + +#### 抽象数据类型的描述 + +``` +ADT 抽象数据类型名{ + 数据对象: <数据对象的定义> + 数据关系: <数据关系的定义> + 基本操作: <基本操作的定义> + 基本操作名(参数表) + 初始条件: <初始条件描述> + 操作结果: <操作结果描述> +}ADT 抽象数据类型名 +``` + +基本操作参数: + +- 赋值参数提供输入值 +- 引用参数以&打头,用于返回操作结果 + +# 数据结构 + +## 线性表 + +线性表的元素可以是各种各样的,但是同一线性表的元素必然具有相同特性-同质 + +线性表中的相邻元素之间存在有序关系-位序 + +线性表是一种“有序结果”,即在数据元素的非空有限集合中 + +- 存在唯一的一个被称为“第一个”的数据元素,无前驱; +- 存在唯一的一个被称为的“最后一个”的数据元素,无后继; +- 除第一个之外,每一个数据元素均只有一个直接前驱; +- 除最后一个之外,每个数据元素均只有一个直接后继 + +线性表中元素个数定义为线性表的长度 + +$$(a_0, a_1, \dots, a_{i-1}, a_i, a_{i+1}, \dots, a_{n-1})$$ + +若线性表为空,则其长度为 0,称为空表 + +在非空表中,每个数据元素都有一个确定的位置 + +- $a_0$是第 0 个数据元素,$a_{n-1}$是第$n-1$个数据元素 +- $a_i$是第 i 个数据元素 +- 称 i 为数据元素$a_i$在线性表中的位序 + +## 线性表 ADT + +```Java +ADT List{ + 数据对象: + 数据关系: + 基本操作: + InitList(&L); + 操作结果:构造一个空的线性表L。 + DestroyList(&L); + 初始条件:线性表已存在。 + 操作结果:销毁线性表L。 + IsEmpty(L); + 初始条件:线性表已存在。 + 操作结果:若L为空表,则返回TRUE,否则返回FALSE。 + ListLength(L); + 初始条件:线性表L已存在。 + 操作结果:用e返回L中第i个数据元素的值 + GetElem(L, i, &e); + 初始条件:线性表L已存在。 + 操作结果;用e返回L中第i个数据元素的值。 + LocateElem(L, e, compare()); + 初始条件:线性表L已存在,compare()是数据元素判定函数。 + 操作结果:返回L中第1个与e满足关系compare()的数据元素的位序。若这样的元素不存在,则返回-1。 + PriorElem(L, cur_e, &pre_e); + 初始条件:线性表L已存在。 + 操作结果:若cur_e是L的数据元素,且不是最后一个,则用next_e返回它的后继,否则操作失败,next_e无定义。 + ClearList(&L); + 初始条件:线性表L已存在; + 操作结果:将L重置为空表。 + ListInsert(&L, i, e); + 初始条件:线性表L已存在, 0 <=i <= ListLength(L)。 + 操作结果:在L中第i个位置插入新的数据元素e,L的长度加1。 + ListDelete(&L, i, &e) + 初始条件:线性表L已存在,0 <= i <= ListLength(L) - 1。 + 操作结果:删除L的第i个数据元素,用e返回其值,L的长度减1。 + ListTraverse(L, visit()); + 初始条件:线性表L已存在。 + 操作结果:依次对L的每个数据元素调用函数 visit()。 + +``` + +线性表的合并:$O(m+n)$ + +线性表的保序归并:$O(m+n)$ + +线性表的顺序存储:顺序表 + +- 用一组地址连续的存储单元依次存储线性表的数据元素 + +顺序表的主要操作: + +插入操作:在顺序表的第 i 个位置插入一个新元素,使顺序表的长度增加到$n+1$ + +复杂度分析: + +- 在顺序表的第$i$个位置插入一个新元素,需要移动$n - i$个元素; +- 假设从顺序表的第$i$个位置插入元素的先验概率为$p_i$ +- 插入操作移动元素次数的期望为$E_{insert} = \sum_{i = 0}^n(n - i) \times p_i$ + +删除操作:把顺序表的第$i$个位置的元素从表中删除,使长度为$n$的顺序表的长度变为$n - 1$ + +复杂度分析: + +- 把顺序表的第$i$个位置上的元素删除,需要移动$n - i -1$个元素 +- 假设从顺序表的第$i$个位置删除元素的先验概率为$q_i$ +- 删除操作移动元素次数的期望为: $E_{delete} = \sum_{i = 0}^{n - 1}(n - i - 1) \times q_i$ + +不失一般性,我们假设插入或删除元素出现在任何位置的概率都是相等的,因此有$p_i = p = 1/(n+1), q_i = q = 1/n$。 + +推导得到: +$$E_{insert} = \frac1{n+1}\sum_{i = 0}^n(n-i) = \frac n2\newline E_{delete} = \frac1n\sum_{i = 0}^{n - 1}(n - i - 1) = \frac{n - 1}2$$ + +## 单向链表 + +最简单的链表结构:链表节点(node)由两个域组成。 + +数据域:存储数据元素, + +指针域:指向直接后继节点 + +单向链表的 C++实现: + +```C++ +class LinkList { +private: + NODE *head; +public: + LinkList() {head = NULL;} + ~LinkList(); + bool clearSqList(); + bool IsEmpty(){return head == NULL;} + bool GetElem(int i, int *e); + int LocateElem(int e); + bool PriorElem(int cur_e, int *next_e); + bool NextElem(int cur_e, int* pre_e); + bool Insert(int i, int e); + bool Delete(int i, int *e); + bool Traverse(bool (*visit)(int e));//遍历所有节点 +} + +``` + +单向链表的不足: + +* 单链表的表长是一个隐含的值,遍历链表才能得到 +* 在单链表中插入或者删除元素时,需要在链表中依序寻找操作位置 +* 在链表中,元素的“位序”概念淡化,结点的“位置”概念强化 +* 如何得到某个元素的前驱? + +改进链表的设置: + +* 增加“表长”、“表尾指针”和“当前位置指针”三个数据域 + +* 将基本操作中的“位序i”改为“指针p” + +## 双向链表 + +由数据,前驱和后继构成。 + +方便寻找前驱,但是增加了维护成本。 + +## 顺序表和链表的比较: + +顺序表 + +用一组地址连续的存储单元依次存储线性表中的数据元素 + +优点:可以随机存取 + +缺点:插入,删除操作需要移动表中的数据元素,事先确定规模,空间效率不高。 + +链表: + +用一组“任意”的存储单元(附加指针)存储表中的数据元素 + +优点:插入,删除操作无需移动表中的数据元素,空间利用率高 + +缺点:不能随机存取 + +## 栈 + +栈是LIFO(Last In First Out,先进后出)的线性表。 + +允许插入和删除的一段称为栈顶(top), 另一端称为栈底(bottom) + +### 栈的ADT + +~~~C++ +{ + Push(&s, e); + Pop(&s, &e); + ClearStack(&s); +} ADT Stack; +~~~ + +### 栈的表示和实现 + +栈的顺序表示 + +top指向最后一个元素可以,指向空也可以,但是实现时要自洽。 + +栈的链式表示 + +有头插入和尾插入两个方式 + +总体来看,头插入比尾插入的优势要更大。首先,插入时虽然头插入要修改的指针更多,但是时间复杂度小,头插入$O(1)$,尾插入$O(n)$。其次,如果以尾部为栈顶,删除时会很麻烦。 + +**静态分配** + +```C++ +#define STACK_MAX_SIZE 100 +``` +**动态分配** + +程序隐含设定 + +```C++ +#define STACK_INT_SIZE 100 +#define STACKINCREMENT 10 +``` + +用户给定 + +### 复杂度分析 + +顺序栈的效率分析 + +时间复杂度 + +* 进栈、出栈:$O(1)$ +* 栈的溢出处理 +* 如果栈元素时简单数据类型,则构造和销毁函数也是$O(1)$的 + +空间复杂度 + +* 顺序栈的长度构造时确定 +* 空间利用效率低 + +链式栈的效率分析 + +时间复杂度 + +* 链式栈的入栈出栈是$O(1)$时间的 +* 建立和销毁是$O(n)$时间的 + +空间复杂度 + +* 一般不会产生溢出 +* 空间利用率高 + +### 栈的一些应用 + +显式应用:括号匹配,表达式求值,迷宫求解 + +隐式应用:函数调用,递归 + +系统栈 + +## 递归 + +栈与递归具有相似性。 + +Fibonacci的递归次数:$C(n) = O(t^n)$ + +(证明思路:归纳法证明$C(n) = 2F(n) - 1$, 根据F(n)通项可以判断。) + +使用递推法的时间复杂度:$O(n)$. + +经常需要进行递归的消除。消除方法:递推,循环等,没有统一的解决方案。可以借用显式栈实现非递归过程。 + +递归的评价: + +* 简洁,便于理解,便于叙述和设计 +* 运行效率低,无法控制递归堆栈的规模 + +## 队列 + +队列是FIFO(First In First Out, 先进先出)的线性表。 + +### 队列的表示和实现 + +队列的顺序表示法 + +入队: rear = rear + 1 + +出队: front = front + 1 + +需要判定队满和队空。 + +顺序队列的问题:被出队的空间不会再次被使用了。 + +循环队列: + +队尾指针指向maxSize - 1时, 入列则指向0; + +队头指针指向maxSize - 1,出列也指向0。 + +可以使用模运算实现。 + +缺点:无法区分队空和队满的状态。 + +区分方法: + +设置一个空位;设置标志;设置队列长度变量 + +队列的链式表示法 + +入队不会出现队满的问题,出队可能回有队空的问题,队空的条件为front = NULL. + +## 串 + +串是有线长度的字符序列。 + +串的长度是字符个数。 + +字符在串中的位置。 + +两个串相等的条件。 + +子串和主串,子串在主串中的位置。 + +### 匹配算法 + +Brute-Force算法:一个一个比。复杂度最高O(m * n)。 + +KMP算法:尽可能跳过更多不必要的匹配。复杂度最多O(m + n)。 + +Horspool算法:启发式算法。复杂度低则O(m/n),高则O(m * n + s),s为字符表规模 + +Boyer-Moore算法:最坏O(n)。KMP和Horspool的综合(或者说Horspool是BM算法的简化版本。) + +## 树与二叉树 + +### 树 + +空树,子树。 + +结点(node)是树的基本单位。 + +结点的度(degree):结点的子树个数。 + +树的度:结点度的最大值。 + +k叉树:树的度为k + +child, parent, cousin, ancestor, descendant + +depth/height + +树的性质: + +1. 树中结点数等于所有结点度数和加一 +2. k叉树第i层至多$k^{i - 1}个结点$ +3. 深度为h的k叉树至多有$(k^h - 1)/(k - 1)$个结点 +4. 具有n个结点的k叉树的最小深度为$[\log_k(n(k - 1) + 1)]$ + +### 二叉树 + +二叉树是结点的一个有限集合,该集合或者为空,或者是由一个根节点加上两棵分别称为左子树和右子树的、互不相交的二叉树组成。 + +二叉树的性质: + +1. 叶子结点数 = 度为二的结点数 + 1 +2. 第i层至多$2^{i - 1}$个结点 +3. 深度为h,则最多有$(2^h - 1)$个结点 +4. 具有n个结点的完全二叉树的深度为$\lceil\log_2(n + 1)\rceil$ +5. 对于完全二叉树(最后一层从右向左缺若干结点),从左向右,从上到下编号,则$\lfloor(i - 1)/2\rfloor$为编号i的parent结点,$2i + 1$为其左子树,$2i + 2$为其右子树。 + +二叉树的顺序表示 + +完全二叉树按照编号存储。不完全二叉树按照它对应的完全二叉树存储,但是缺少的部分留空。 + +不完全二叉树结点越少,空间效率越低。 + +二叉树的链式表示 + +空间效率很高。 + +二叉树的遍历: + +记根节点为V,遍历左子树为L,遍历右子树记为R + +先序遍历:V - L - R + +中序遍历:L - V - R + +后序遍历:L - R - V + +遍历可以通过递归实现,但是递归可能会对效率产生影响。可以利用栈的特性实现遍历。 + +层序遍历:从上到下优先遍历同一层的结点。 + +遍历实现了树的线索化过程。 + +### 霍夫曼树 + +霍夫曼树:寻找加权路径长度(WPL)的最小树。 + +用途:实现性能最好的变长二进制编码。 + +霍夫曼编码不是唯一的,但是所有霍夫曼树的WPL都相等。 + +不足: + +没有错误保护功能 + +### 二叉树的建立 + +只知道二叉树的先序序列,不能确定这棵二叉树。 + +但是如果同时知道先序序列和中序序列,则可以确定这棵二叉树。 + +## 图 + +### 概念 + +图的定义 + +顶点,边,弧 + +邻接顶点 + +有向图,无向图 + +有向完全图,无向完全图 + +子图 + +握手定理,度 + +权,网络 +边上的数叫做权。有权的图叫网络。 + +连通 + +连通图 + +连通分量 +无向图的极大连通子图为连通分量。(所谓极大,就是再加入一个点都会导致它不连通) + +强连通图 +有向图中存在vi到vj且存在vj到vi的图。 + +强连通分量 +有向图的极大强连通子图为强连通分量。 + +Euler路径和Euler回路 + +图的存储和表示 + +邻接矩阵表示 +如果v和w之间有边,则元素为1,否则为0. + +邻接表表示 +采用链表数组表示图。同一个顶点发出的边在同一个链表中。 + +### 图的遍历 + +深度优先遍历和广度优先遍历 + +图的遍历:从已给连通图的某一顶点出发,沿着一些边访问所有顶点,且每个顶点只访问一次,则叫做图的遍历。 + +邻接矩阵的遍历:$O(v^2)$ + +邻接表的遍历:$O(v + e)$ + +### 生成树 + +连通图的生成树,包含图中全部n个顶点,但只有n-1条边。 + +深度优先和广度优先遍历分别会得到一个搜索树。 + +最小生成树:权值之和最小的生成树。 + +求最小生成树的算法:贪心算法思想。Kruskal算法和Prim算法。 + +Prim算法 + +![](../images/DSA/Prim.jpg) + +Prim算法的时间复杂度为$O(n^2)$。对稠密图而言是线性的。对于稠密图而言,Prim的邻接矩阵实现是首选方法。 + +Kruskal算法 +![](../images/DSA/Kruskal.jpg) + +Kruskal的时间复杂度为$O(E\log E)$。 + +Kruskal算法对于稀疏图是好的选择。 + +### 最短路径树 + +从根到其他顶点的最短路径 + +源点-汇点最短路径:给定一个起始顶点s和一个结束顶点 ,在图中找出从s到t的一条路径。起始顶点称为“源点”,结束顶点称为“汇点” + +单源最短路径:给定一个起始顶点s,找出从s到图中其它各顶点的最短路径 + +全源最短路径:找出连接图中各对顶点的最短路径 + +#### 单源最短路径 + +Dijkstra算法 + +![](../images/DSA/Dijkstra.jpg) + +Dijkstra算法通过构造加权有向图图的最短路径树SPT,来实现单源最短路径算法。 + +时间复杂度为$O(v^2)$,和Prim算法很相似。 + +#### 全源最短路径 + +可以对每个顶点用Dijkstra算法。 + +Floyd算法 + +时间复杂度:$O(v^3)$。可以计算出一个网络中所有的最短路径。 + +Floyd算法允许图中带有负权值的边,但不允许有包含带负权值的边组成回路。 + +# 算法 + +## 非数值算法 + +### 查找 + +查找算法的复杂性:关键字/数据规模 + +查找算法的分类: +* 内部/外部 +* 静态/动态 + +#### 查找表 + +查找表(Search Table)是由同一类型数据元素构成的集合。 + +按关键字查找 +1. 查询某元素是否存在 +2. 检索某数据元素的各种属性 +3. 在查找表中插入一个数据元素 +4. 从查找表中删除一个数据元素 + +查找表的种类 +1. 静态查找表-仅可执行1,2 +2. 可执行1,2,3,4 + +平均查找长度:在查找过程中,为确定目标在查找表中的位置,需要进行关键字比较次数的期望值 + +$$ +ASL = \sum_{0}^{n - 1}P_i C_i +$$ + +$P_i$为第i条记录的查找概率,$C_i$为第i条记录的查找长度。 + +有时我们会假设查找概率相等或不等,有时要考虑查找失败的比较次数。 + +ASL越小,查找性能越好。 + +顺序查找:又称线性查找,是从线性 +表的一端开始,依次把每个元素的 +关键字同给定值进行比较 + +假设每个元素的查找概率相等,则平均查找长度为:$ASL = \sum_0^{n - 1}\frac{i + 1}{n} = \frac{n + 1}{2}$。 + +更多考虑:查找概率不等;查找失败需要N次比较;越界判断 + +折半查找:如果顺序表有序,我们可以采用高效率的折半查找 + +折半查找可以用一个二叉树结构来表述。比较次数不会超过$\lfloor\log_2 N + 1\rfloor$。 + +索引查找:将线性表划分为若干子表,再建立指向这若干子表的一个索引表。相同性质的数据归类到一个子表中。 + +索引表:顺序表或链表 + +子表:顺序表或链表 + +因而可以有四种不同的索引存储方式。 + +索引表的特点:表不大, 表中元素不常变动。因而适合用顺序表来表示索引表。 + +分块查找:也称索引顺序查找,是顺序查找的改进。子表之间有序;块内元素无序。索引表包括关键字项,指针项,子表长度。 + +索引文件:单关键字,多关键字。 + +稠密索引:索引表的索引项和主文件的各记录一一对应,称为稠密索引。 + +稀疏索引(非稠密索引):索引项对应主文件的一部分记录。 + +索引文件的好处:减少访问外存的次数,提高查找速度。 + +倒排文件:不同之处是辅索引表包含物理地址序列。(为什么要倒排?) + +#### 二叉搜索树(BST) + +或者是一棵空树,或者是具有下列性质 +的二叉树:每个结点有一个关键字(key), +并且: +1. 任意结点关键字大于等于该结点左 +子树中所有结点含有的关键字 +2. 同时该结点的关键字小于等于右子 +树中所有结点含有的关键字 + +BST是一种重要的动态搜索结构。它的中序遍历是确定的。 + +BST的插入操作和查找操作同样简单。 + + +删除操作比较复杂。叶子结点的删除比较简单;如果结点只有一棵子树,也比较简单;如果左右子树都不空,可以用中序后继替换。 + +BST的性能:越“平衡”越好。 + +二叉搜索树的路径长度和高度直接关系到BST中搜索的开销,对于一棵 +含有N个关键字的BST +* 最好情况下,所有搜索都可以保证对数运行时间 +* 最坏情况下,进行一次搜索需要 次比较 +* 平均情况下搜索需要 次比较操作 + +BST的旋转操作:结点和一个子孙交换角色。分为左旋转和右旋转。右旋转涉及到结点和右孩子。(右旋转和左旋转是以结点自己作为参考系而言。) + +BST通过不断的旋转来保证自己的平衡性。 + +AVL树: +一棵AVL树或者是空树,或者是具有下列性质的二叉搜索树: +1. 左子树和右子树都是AVL树 +1. 且左子树和右子树的高度之差的绝对 +值不超过1 + +AVL的高度为$O(\log_2 n)$,平均查找长度也为$O(\log_2 n)$。 + +AVL具有良好的搜索性能,能够避免一般BST性能恶化的问题。但是AVL的维护比较复杂,在进行插入和删除操作后,都必须通过大量的旋转操作保证AVL的平衡性。 + +寻找其他方法,以提高BST的平衡程度,保证BST的性能。 + +* 实用的平衡二叉搜索树-红黑树 + +* 多路平衡的动态查找结构-B-树 + +#### 散列 + +散列的关键是散列函数和冲突处理。 + +散列函数应是简单的,能在较短的时间内计算出结果 + +散列函数的定义域必须包括需要存储的全部关键码,如果散列表允许有m +个地址,其值域必须在0到m-1之间 + +理想的散列函数应近似为随机的,对每一个输入,相应的输出在值域上是 +等概的。 + +冲突处理: + +* 链地址法:把散列到同一个地址的关键字存进链表中。(表长小于元素数目) +* 开放定址法:放在表中空的位置。查找时采用“探测”的方法。如果探测下一个位置,称为线性探测。(表长大于元素数目,稀疏表,一般不允许表达到半满状态) +* 双重散列法:用第二个散列函数表达散列的增量。时间复杂度略大,但是性能比线性探测好很多。 + +散列的其他应用:字符串的匹配;搜索引擎对URL的散列;信息安全中的内容鉴别技术(MD5, sha)。 + +散列提供常数时间的查找性能,实现简单;但是好的散列函数不易找到,删除操作和空间性能不好,最坏情况下性能不好,忽略了数据间的逻辑关系。 + +### 排序 + +排序算法的稳定性:如果两个对象的排序码相等,排序前后的顺序不变,则是稳定的;否则是不稳定的。 + +内排序:数据对象存放在内存。 + +外排序:数据对象在内、外存之间移动。 + +冒泡排序:复杂度为$O(n^2)$。添加排序标记,最好情况下只需要$n - 1$次比较和0次交换。 + +插入排序:有直接插入,折半插入,希尔排序 + +直接插入:$O(n^2)$ + +折半插入:查找插入位置的时候可以采用折半查找,因为表中可以插入的部分已经排好序了。复杂度没有变化,依然是$O(n^2)$ + +希尔排序:如果序列中,间距为h的元素都有序,称这个序列为h-排序的。希尔排序就是不断缩小h,直到h=1。 + +选择特定的步长序列$h_n$,取出序列中增量为$h_n$的子列进行插入排序。然后取$h_{n-1}$,直至取$h_1=1$。 + +它在h比较大的时候排序,由于间距短,速度快;而h小的时候,由于有序性强,速度快。总体速度依赖于步长序列的选择,时间复杂度比直接插入好一些。 + +选择排序:比较次数$O(n^2)$,移动次数$O(n)$,移动次数少一些。 + +冒泡排序和插入排序都是稳定的,而选择排序是不稳定的。 + +**快速排序**:一种交换类排序。具有很好的性能。 + +将待排序序列分为两个部分,满足: +1. a[i]位于它在序列中的正确位置 +2. 前面的元素比a[i]小 +3. 后面的元素比a[i]大 +然后对两个部分继续划分,每次划分都将一个元素划分到它的正确位置。 + +如何划分: + +选择划分元素v。从序列左边扫描,找到一个比v大的元素,从右边扫描,找到一个比v小的元素,交换两个元素。反复交换,直到左右扫描指针相遇,则划分完成。 + +快速排序的递归树是一颗二叉搜索树,因为每次递归都是对比自己大和比自己小的两个部分递归。 + +时间复杂度:理想情况下$O(N\log_2N)$,如果递归树是平衡的。平均情况下为$O(N\log N)$,而最坏情况下退化为$O(N^2)$。 + +快速排序是不稳定的排序算法。 + +改进: + +划分元素是最大或者最小的元素时是最坏情况。为了避免最坏情况,采用中间元素法:取序列的左端元素,右端元素和中间元素,选择关键字处于中间的元素作为划分元素。 + +快速排序中,子序列非常小时仍然要递归调用,可以采用插入排序代替,提高效率。 + +归并排序:合并有序表。两个表的归并,叫二路归并。利用二路归并可以实现归并排序。 + +自底向上归并:将文件分割成长度为m的子序列,每次m翻倍。 + +自顶向下归并:将文件分割为两个部分,分别进行递归的归并排序后再合起来进行归并排序。 + +归并排序是稳定的,时间最好情况是$O(N\log N)$,最坏是$O(N^2)$. + +堆:堆是满足堆性质的完全二叉树。 + +最大堆:任意节点的值小于父节点的值。 + +最小堆;任意节点的值小于父节点的值。 + +因为是完全二叉树,适合用顺序存储方式。 + +堆:顺序存储在一维数组中。 + +堆的操作,例如插入,删除或者修改结点会破坏堆的性质,因此修复堆是重要的操作。 + +对于最大堆,如果某结点的关键值小于其子节点的关键值,可以采用自顶向下堆化(Heapify-down)的算法进行修复。 + +对于最大堆,若结点的关键值大于父节点的关键值,采用自底向上堆化(Heapify-up的算法进行修复) + +向堆中插入结点:在新节点插入堆尾,调用自底向上算法调整堆。这种构造堆方法称为自顶向下的堆构造。 + +自顶向下的堆构造:$O(N\log N)$ + +自底向上的堆构造:时间复杂度$O(N)$ + +自底向上构造复杂度小的原因:离根远的复杂度小,离根近的复杂度大。而自顶向下是离根远的复杂度大,离根近的复杂度小。离根远的数量多,而离根近的数量少,因此自底向上的整体的复杂度更小。 + +优先级队列可以用堆实现,性能非常好。 + +堆排序:节约空间,比较次数和移动次数都是$O(N\log N)$。堆排序是不稳定的排序方法。 + +从小到大排序的方法:自底向上构造最大堆。将堆首与堆尾交换,堆序列长度-1,调整堆,再次交换,重复上述过程,直到堆空。 + +>堆排序大概可以理解成优先队列的出队过程。 + +采用决策树的方法可以求得比较次数的下界为$O(N\log N)$ + +## 数值算法 + +### 基础 + +一个数值问题是适定的(well posed),需要满足: +* 解存在 +* 解唯一 +* 连续地依赖于问题数据 + +不满足条件的问题被称为不适定的(ill-posed)。 + +适定的问题,如果解对输入数据非常敏感,则称之为病态的(ill-conditioned)。 + +针对适定和良态(well-conditioned)问题,数值分析可以得到具有一定精度的近似解。 + +数值分析重视误差。误差=计算误差+传播误差,算法影响的是计算误差。误差有模型误差、测量误差、截断误差、舍入误差。 + +前向误差反映了输出的误差,后向误差反映了输入的误差。相对前向误差与相对后向误差的比值叫做条件数(condition number)。$cond \le 1$说明问题是良态的;否则是病态的。 + +实际问题中我们通常求解条件数的估计值或者上限。进而求得前向误差。 + +相对条件数:$\left|\frac{xf^\prime (x)}{f(x)}\right|$。绝对条件数:$\left|f(x)\right|$ + +算法的稳定性:如果一个算法对于计算过程中的微小扰动不敏感,则算法是稳定的。 + +问题的病态性针对输入数据的微小扰动,而算法的稳定性针对的是计算过程中的误差。 + +最近舍入法:与x最相近的浮点数,如果相等,取最后一个存储位为偶数。 + +若是偶数,则区间是闭区间;若是奇数,则对应的区间为开区间。 + +浮点数的下溢限主要由尾数决定,机器精度由尾数决定。 + +浮点数的表示法: + +$$ +x = \pm \left(d_0 + \frac{d_1} \beta + \frac{d_2} {\beta^{2}}+ \dots + \frac{d_{p-1}} {\beta^{p-1} } \right)\beta^E +$$ + +在正规化浮点数系统中: +$$ +\text{UFL}=\beta_L\\ +\text{OFL}=\beta^{U+1}(1 - \beta^{1-p})\\ +$$ + +机器精度:舍入造成的相对误差上限: +$$ +\left|\frac{fl(x) - x}{x}\right| \le \epsilon_{mach} +$$ + +最近舍入方式下: +$$ +\epsilon_{mach} = \beta^{1-p} / 2 +$$ + +### 线性方程求解 + +解矩阵方程$A\mathbb x = \mathbb b$。 + +误差分析: + +条件数:$\text{cond}(A) = ||A||||A^{-1}||$ + +直观理解:两条线接近平行的时候,两条线截距的轻微扰动会造成解很大的不确定性。 + +解方程: + +直接求解法 + +高斯消元法:复杂度$O(n^3)$。通常采用列选主元的方法提高算法的稳定性。 + +LU分解:如果$b$变化而$A$不变,可以较快地多次求解。 + +解的精度分析:条件数大,即使残差很小,也会得出极大的计算误差。是因为问题本身非常敏感。 + +高斯-约当法:把A变换为对角阵。 + +乔列斯基分解:A是对称正定阵,则A=LL'。 +* 算法是良态的 +* 不需要选主元就有稳定性 +* 只需要存储下三角部分即可 +* 分解的乘法和加法次数都约为$n^3/6$ + +线性方程的迭代解法: + +不动点迭代法: + +$$ +Ax = b \Rightarrow x = Gx + C +$$ + +不动点迭代的收敛核心在于G。 + +对于矩阵M,定义谱半径$\rho(M)$为M的特征值绝对值的最大值。 + +如果$\rho(G)< 1$,则不动点迭代收敛。 + +分裂$A = M - N$,则 + +$$ +(M - N)x = b\Rightarrow\\ +x = M^{-1}Nx + M^{-1}b +$$ + +当$\rho(M^{-1}N) < 1$时,不动点迭代收敛。 + +Jacobi(雅克比)方法:$A = D + L + U$, $M = D$, $N = - (L + U)$, $x^{k+1} = D^{-1}[b - (L+U)x^k]$。 + +高斯-赛德方法: +$A = D + L + U$, $M = D + L$, $N = -U$, $x^{k+1} = (D+L)^{-1}(b - Ux^k)$。 + +这两种迭代都不一定收敛,但是实际中一般都可以。高斯赛德方法速度比雅克比快一倍。 + +### 非线性方程求解 + +误差分析: + +非线性方程$f(x) = 0$,真解为$x^*$,近似解为$\hat x$。 + +残差:$||f(\hat x)||$ + +前向误差:$||\hat x - x^*||$,能更准确地描述解的精确程度。 + +绝对条件数:$1/|f^\prime(x^*)|$ + +可见,如果f(x)在$x^*$处接近水平,则问题是病态的。 + +具有重根的问题也是病态的。 + +解法: + +二分法:定义误差$e_k = x_k - x^*$,定义迭代法的收敛速度定义:$\lim_{k\rightarrow \infty}\frac{||e_{k + 1}||}{||e_k||^r} = C$,则收敛速度为$r$。r=1称为线性的,r>1称为超线性的,r=2称为平方的。二分法的迭代次数与函数的具体形式无关。 + +不动点迭代法: + +收敛性: + +$$ +\lim_{k\rightarrow \infty}\frac{||e_{k+1}||}{||e_k||} \\=\lim_{k\rightarrow \infty}\frac{g(x_k) - x^*}{x_k - x^*} \\ += \lim_{k\rightarrow \infty} g^\prime (\xi_k) = g^\prime(x^*) +$$ + +绝对条件数为$g^\prime(x^*)$。如果$|g^\prime(x^*)|$非零,则收敛是线性的,如果为0,则是超线性的。 + +牛顿迭代法: + +$$ +x_{k + 1} = x_k - \frac{f(x_k)}{f^\prime(x_k)} +$$ + +由于$g^\prime(x^*)=0$,收敛是超线性的。进一步分析得到$\lim_{k\rightarrow \infty}\frac{x_{k+1} - x^*}{(x_k - x^*)^2} = \frac{f^{\prime\prime}(x^*)}{2f^\prime(x)}$,因此牛顿法是平方收敛的。 + +牛顿法的特点: +* 初值的选取很重要 +* $f^\prime(x)\ne 0$ +* 速度快,但是可能出现振荡的情况 +* 对多重根的收敛速度退化为线性 +* 涉及到求导,有时候比较困难 + +准牛顿法:免去了求导 + +$$ +x_{k + 1} = x_k - \frac{f(x_k)}{g_k} +$$ + +割线法:准牛顿法的一种 + +$$ +g_k = \frac{f(x_k) - f(x_{k - 1})}{x_k - x_{k - 1}} +$$ + +反插:割线法是用两次的迭代值确定一条直线,取直线与x轴的交点。可以采用反二次插值:用前三次迭代值确定抛物线$x = p(y)$,取它与x轴的交点。 + +二分法较安全,但速度慢;迭代法速度快,但不安全。可以在区间较大时采用二分法缩小区间,等区间较小时再采用迭代法。 + +### 拟合与插值 + +#### 拟合 + +如果方程的数目多于未知数的数目,则是超定方程。 + +如果方程的数目少于未知数的数目,则是欠定方程。 + +超定方程在线性最小二乘的意义下得到一个近似解。 + +转而求解$A^TAx = A^Tb$。如果矩阵A是列满秩的,则解唯一。 + +若$A^TA$是正定的,则有$A = LL^T$。 + +可以采用QR分解将长方阵A简化: + +$$ +A = Q\begin{bmatrix} +R\\ +0 +\end{bmatrix} +$$ + +进一步,如果$Q = \begin{bmatrix}Q_1\\Q_2\end{bmatrix}$,则$Rx = Q_1^Tb$。 + +利用household变换进行QR分解。 + +正规方程方法的复杂度:$mn^2/2 + n^3/6$ + +household变换的复杂度:$mn^2 - n^3 / 3$ + +如果m和n相当,则两种变换的复杂度相当,而m远大于n时,QR分解的复杂度是正规方程方法的两倍。 + +QR分解的适用性更宽。 + +#### 插值 + +插值使得函数精确地通过给定数据点。 + +单项式基底:$\phi_j(x) = x^{j - 1}$。给定点数越多的插值问题,病态性越高,插值多项式的系数不稳定。 + +霍纳法则:$t_1 + x(t_2+x(t_3+(\dotsb)))$,减少乘法次数。 + +拉格朗日插值: + +$$ +l_j(x) = \frac{\prod_{k = 1, k \ne j}^{n}(x - x_k)}{\prod_{k = 1, k\ne j}^{n}(x_j - x_k)} +$$ + +* 确定形式容易 +* 计算值困难 +* 微分,积分不方便 + +牛顿插值:基底取$\prod_{k = 1}^{j - 1}(t - t_k)$。 + +* 容易确定,系数较容易求解 +* 计算可以通过类似霍纳法则的方法求得,时间复杂度低 +* 在确定和求值之间形成了较好的平衡。 + +### 优化问题 + +分为连续优化问题和离散优化问题。 + +可行点,约束集合。 + +#### 连续优化问题 + +有线性规划和非线性规划问题。 + +线性规划:不细讲。 + +非线性规划: + +(严格/非严格)全局最小值,局部最小值。全局最小值的求解,甚至验证都很困难。 + +闭集:闭集是补集为开集的集合。如果一个集合中所有的极限点都是这个集合中的点,则这个集合是闭集。 + +有界闭集上的连续函数有全局最小值。如果不是闭的或者无界,就可能没有最小值。 + +$\lim_{||x||\rightarrow \infty} f(x) = \infty$,称$f(x)$在无界闭集$S\sube \mathbb{R^n}$上是强制的。 + +如果连续函数$f$在无界闭集$S\sube \mathbb{R^n}$上是强制的,则$f$在$S$上存在全局最小值。 + +集合是凸的:任意两点的连线属于这个集合。 + +函数是凸的:区间内函数值不超过端点连线上的函数值。 + +如果集合和函数都是凸的,称为凸优化问题。 + +我们有如下结论: +* 如果$f$是凸集$S\sube \mathbb{R^n}$上的凸函数,则在 $S\sube \mathbb{R^n}$的任意内点上连续 +* 凸函数$f$在凸集$S\sube \mathbb{R^n}$上的任意局部最小值,都是$f$在$S\sube \mathbb{R^n}$上的全局最小值 +* 严格凸函数$f$在凸集 $S\sube \mathbb{R^n}$上的局部最小值,是$f$在$S\sube \mathbb{R^n}$上的唯一全局最小值 +* 如果$f$在有界闭集$S\sube \mathbb{R^n}$上严格凸,则$f$在$S\sube \mathbb{R^n}$上存在唯一的全局最小值 +* 如果$f$在无界闭集 $S\sube \mathbb{R^n}$上严格凸,则$f$在$S\sube \mathbb{R^n}$上存在唯一全局最小值的充要 +条件是$f$在$S\sube \mathbb{R^n}$上是强制的 + +下面考虑无约束优化: + +梯度为0的点是临界点。 + +临界点可能是局部最大值/最小值/鞍点。 + +如果函数是凸的,临界点就是全局最小值点。 + +海森矩阵正定,则f是凸的。 + +如果$x^*$是函数$f$的最小值, +则$\nabla f(x^*) = 0$,$\nabla^2f(x^*)$非负定。 + +如果$\nabla f(x^*) = 0$且$\nabla^2f(x^*)$正定,则$x^*$是严格局部最小值。 + +如果是凸优化,则$\nabla f(x^*) = 0\Leftrightarrow f(x^*)$为严格局部最小值 + +矩阵的正定性: +* 特征值全正 +* Cholesky分解唯一 +* 顺序主子式的行列式全正 + +拉格朗日乘数法: + +$$ +\mathcal{L}(x, \lambda) = f(x) + \lambda^Tg(x) +$$ + +海森矩阵: + +$$ +H_{\mathcal{L}}(x, \lambda) = \begin{bmatrix} + B(x, \lambda) && J_g^T(x)\\ + J_g(x) && 0 +\end{bmatrix}\\ +B(x,\lambda) = H_f(x) + \sum_{i = 1}^m\lambda_iH_{g_i}(x) +$$ + +只要$B(x^*, \lambda^*)$正定,则$x^*$是极小值点。 + +敏感性和病态性:依赖于海森矩阵 +* 海森矩阵奇异,则极值问题病态 +* 海森矩阵接近奇异,则极值问题敏感 + +下面考虑一维优化问题: + +单峰函数:最小值左侧递减,最小值右侧递增。 + +类似于二分法,可以用黄金分割搜索求单峰函数的极小值。 + +好处:每次迭代只需要更新一个点;安全性好;收敛速度线性; + +坏处:收敛速度还可以提高。 + +方法二:逐次抛物插值。用两个端点和一个近似极值点拟合一条抛物线,取抛物线的最小值点作为新的近似极值点,反复直到收敛。 + +当初始点接近极值点时能够收敛;收敛是超线性的。 + +牛顿迭代法: +$$ +x_{k + 1} = x_k - \frac{f'(x_k)}{f''(x_k)} +$$ + +实际上采用黄金分割搜索和逐次抛物插值混合方案,避免求函数的导数。 + +多维优化问题: + +最速下降法: +$$ +x_{k + 1} = x_k - \alpha_k\nabla f(x_k) +$$ + +确定$\alpha_k$:$\min_{\alpha_k} f(x_k - \alpha_k \nabla f(x_k))$ + +非常可靠,只要梯度不为0;速度可能不快,呈之字形;收敛速度线性;初值的选择很重要。 + +牛顿法: +$$ +x_{k + 1} = x_k - H_f^{-1}(x_k)\nabla f(x_k) +$$ + +平方收敛,速度快于梯度下降;需要距离最优解很近;不需要搜索参数;如果目标具有连续的二阶偏导数,则海森矩阵对称。 + +拟牛顿法 + +$$ +x_{k + 1} = x_k - \alpha_kB_k^{-1}\nabla f(x_k) +$$ + +## 算法设计思想 + +### 贪心算法 + +* 可行性 +* 局部最优 +* 不可取消 + +不是所有优化问题都能通过贪心算法求解,即使可以使用贪心算法,也不一定能够得到最优解。 + +如果一个优化问题可以通过局部最优选择得到全局最优解,则说这个问题满足贪心选择性质,此时可以简单高效地求得问题的最优解。 + +贪心策略可以有很多种。不同的算法有不同的性能。不一定得到全局最优解。 + +### 动态规划 + +多阶段动态过程的优化问题 + +阶段:把问题分成几个相互联系的有顺序的几个环节,这些环节被称 +为阶段 + +状态:某一阶段的出发位置称为状态。通俗的说状态是对问题在某一 +时刻的进展情况的数学描述 + +决策:从某阶段的一个状态演变到下一个阶段某状态的选择 + +条件:最优化原理;无后效性 + +动态规划用空间换时间,有大量重叠子问题时才能体现它的优势。 + +例:Floyd算法,Viterbi译码 + +### 蛮力法 + +### 分治法 + +快速排序 + +分治法:分成若干个小的同类问题 + +减治法:变成一个更小的同类问题 + +变治法:变成若干个更简单的问题 + +### 搜索算法 + +组合优化问题的解空间指的是搜索答案的过程中搜索过的可行解。 + +回溯法:没有希望的解就不去搜索。 + +分支界限法:一边搜索一边给出当前部分解的下界。对于下界比搜索到的可行解还大的分支,不去搜索。下界的估计方法很重要。 + +回溯法和分支界限法都不能保证求解的效率。 + +### 随机算法 + +Sherwood算法 + +快速排序在某些序列下会发生时间复杂度的退化。随机划分元素,可以使得达到最坏复杂度的概率降到很低。 + +一般地,若确定型算法在最坏情况下的时间复杂度和它在平均情况下的时间复杂度有较大的差异,通过随机性可以消除这种差别。并不是避免这种最坏的情况发生,而是切除这种最坏情况和特定实例之间的联系。 + +Las Vegas算法 + +* 随机化决策 +* 减少算法运行的时间 +* 有概率会失败 +* 多尝试几次以提高成功率 + +Monte Carlo算法 + +* 概率为基础的统计模拟方法 +* 不保证得到正确的解 +* 设计合理,大量重复可以大概率得到高精度的解 + +随机投点求面积 + +一个蒙特卡洛方法得到正确判定的概率不小于p,则算法是p正确的。 + +如果同一实例不会给出不同的解,称算法是一致的。 + +对于判定问题,如果能够保证返回true时是正确的,称为偏真的;保证返回false时是正确的,则算法是偏假的。 + +Sherwood:一定得到正确解,一般不会遇到最坏情况 + +Las Vegas:不一定得到正确解,但如果得到了一定是正确的 + +Monte Carlo:不一定得到正确解,即使得到了也不一定是正确的 + +### 算法优化技术 + +输入增强技术 + +* 字符串匹配算法 + +* 计数排序 + +预构造技术 + +* 并查集 + +* 二叉查找树 + +* 倒排索引 + +* 堆和堆排序 + +时空平衡 + +* 比特逆序 +* 散列 + diff --git a/blitherboom-blog/pages/posts/Digital-Signal-Processing.md b/blitherboom-blog/pages/posts/Digital-Signal-Processing.md new file mode 100644 index 00000000..fb8181ef --- /dev/null +++ b/blitherboom-blog/pages/posts/Digital-Signal-Processing.md @@ -0,0 +1,1220 @@ +--- +title: Digital Signal Processing +date: 2023-09-20 09:51:58 +tags: note +katex: true +--- + + +## 绪论 + +### 信号 + +信号是某种随时间或/和空间变化的物理量,其包含有从信源到信宿的某种信息。 + +信号可以根据时间和幅度的取值方式分类 +- 连续时间信号 +- - 在时间和幅度上均可以连续取值的信号 +- 离散时间信号 +- - 仅在离散时间点上取值,但可在幅度上连续取值的 +信号 +- 数字信号 +- - 仅在离散时间点上取值,且在幅度上只能离散取值 +的信号 + +### 系统 + +- 由若干相互作用和相互依赖的事物组合而成的具有特 +定功能的整体 +- 具有它自身的结构、行为和性质,通过输入和输出与 +其所处的环境进行交互,通常实现一定的功能 +- 可通过分析给定输入下输出的性质,来研究其行为和 +性质 + +信号处理系统 +- 对信号进行某种操作的单元或模块 +- 从数学上看,可视为作用于函数上的算子 + +通常根据信号处理单元而非输入输出信号性质分类 +- 连续(模拟)信号处理系统 +- - 由电阻、电容、电感和放大器等组成的模拟电路完成信号处 +理功能 +- - 直接处理连续信号 +- 离散信号处理系统 +- - 由CCD、电容和放大器等组成的离散电路完成信号处理功能 +- - 处理由连续信号采样而来的离散时间信号 +- 数字信号处理系统 +- - 信号处理功能由数字逻辑电路或通用计算机来完成 +- - 处理数字信号(例如来源于对连续信号的采样和量化) + +模拟 -> 采样量化 -> 数字信号处理系统 -> 模拟重建 -> 模拟输出信号 + +### 数字信号处理的局限 +- ADC和DAC器件的处理能力 +- - 是否能够准确提取出原连续信号中的信息首先决定于 +ADC:采样率、量化位数、时钟抖动、线性度等 +- 精度受量化和舍入误差影响 +- - 有限字长效应:数字系统中数字表示和计算精度受字 +长限制 +- 适合于数字处理的信号带宽受处理能力的限制 +- - 例如,信号带宽10MHz、采样率20MHz、FIR滤波器阶 +数为500,则所需计算量为每秒10G次的乘累加 +- - 如果带宽为1GHz呢? + +### 数字信号处理的发展 +- 20世纪初至50年代有许多前期的研究工作,从采样 +定理的建立到声码器的数字仿真实验等,奠定了理论 +基础 +- 1965年FFT的提出,是DSP发展的里程碑 (但其源头 +可追溯到高斯时代) +- 离散变换的进展:65年FFT,70年代余弦变换,80年 +代中后期小波变换 +- 滤波器设计技术:IIR、FIR数字滤波器,多采样处理 +和滤波器组理论,专用滤波器设计,小波滤波 +- 统计和自适应信号处理,阵列处理等,从统计学引入 +信号处理发展的另一条主线——现代信号处理 +- 器件和系统的发展对数字信号处理有积极推动 + +### 从模拟到数字 + +模拟信号的数字化:ADC + +采样:本课程主要考虑均匀采样。 + +$$ +x[n] = x_a(nT) -\infty \lt n \lt \infty\\ +f_s = 1/T\\ +\Omega_s = 2\pi f_s +$$ + +采样的实现:采样保持电路 + +采样周期:与被采样信号的频带参数一起决定了采样过程是否会发生混叠。 + +采样过程的模糊性:采样过程可看作一种由连续信号空间到离散信号空间的多对一映射;对于给定的采样周期,仍存在无穷多个连续信号与同一离散信号对应。需要施加某种约束条件。 + + 采样过程的基本问题: +- 采样过程是否会引起被采样信号的信息丢失? +- 被采样的连续信号是否能从采样样本中完全恢复? +- 采样过程的频域分析可获得上述问题的答案 +- - 推导得到采样后离散信号和采样前连续信号频谱间的数学关系 +- - 确定可以消除采样过程模糊性的条件 +- - 为实际数字信号处理系统设计中采样频率的选择、抗混叠前置滤波器的设计提供指导 + +采样的数学表示: + +$$ +s(t) = \sum_{n = -\infty}^{\infty}\delta(t - nT)\\ +x_s(t) = x_a(t) \cdot s(t)\\ +x[n] = x_a(nT) +$$ + +对连续信号进行采样,其频谱是原始信号的周期延拓,延拓周期为采样频率 + +$$ +\begin{align*} +\text{时域} & \quad \quad \text{频域} \\ +x_a(t) & \quad \quad X_a(j\Omega)\\ +s(t) & \quad \quad S(j\Omega) = \frac{2\pi}{T} \sum_{k=-\infty}^{+\infty} \delta(\Omega - k\Omega_s)\\ +x_a(t) \cdot s(t) & \quad \quad X_S(j\Omega) = \frac{1}{T} \sum_{k=-\infty}^{+\infty} X_a\bigg(j(\Omega - k\Omega_s)\bigg) +\end{align*} +$$ + +带限信号和带通信号: +* 带限信号:$X_a(j\Omega) = 0, |\Omega| \ge \Omega_H$ +* 带通信号:$X_a(j\Omega) = 0, |\Omega| \ge \Omega_H\text{ or }|\Omega| \le \Omega_L$ + +带限信号的采样: + + + +$$ +X_S(j\Omega) = \frac{1}{T} \sum_{k=-\infty}^{+\infty} X_a[j(\Omega - k\Omega_S)], \Omega_s \ge 2\Omega_H +$$ + +对应的离散时间序列: + +$$ +X(e^{j\Omega T}) = X_S(j\Omega) = \frac{1}{T} \sum_{k=-\infty}^{+\infty} X_a[j(\Omega - k\Omega_S)]\\ +\Rightarrow X(e^{j\omega}) = X_S(j\Omega) = \frac{1}{T} \sum_{k=-\infty}^{+\infty} X_a[j(\omega - 2\pi k)/T]\\ +$$ + +带通采样让时间以$T \rightarrow 1$的形式进行归一化,频率以$\Omega_s \rightarrow 2\pi$的形式进行归一化。 + +Nyquist 采样定理: + +$$ +X_a(j\Omega) = 0, \forall |\Omega| \ge \Omega_H\\ +\Omega_s = 2\pi / T \gt 2\Omega_H +$$ + +或者归一化频率 + +$$ +\omega_H = \Omega_H T < \pi +$$ + +Remark: +- $𝑥_𝑎(𝑡)$ 是基带、带限信号 +- Nyquist是充分条件,即对被采样信号无其他假设 +- 在仅知道连续信号最高频率时,Nyquist采样定理给出 +了由采样信号唯一确定(或恢复)原信号的条件 +- - 已知连续信号最高频率,可用于确定最低采样频率 +- - 已知采样频率,可确定无混叠连续信号的最高频率 + +带通信号的采样: + +$$ +\frac{2f_H}{m+1} \le f_s \le \frac{2f_L}{m}, m\in \N ,m \le f_L/B +$$ + +带限连续信号的重建: +- 由离散序列𝑥[𝑛]和采样周期𝑇,恢复原连续信号$𝑥_𝑟(𝑡)$ +- 由序列到冲激串转换和重建滤波两个步骤构成 +- 重建后的信号表示为 + +$$ +x_r(t) = \sum_{x = -\infty}^{\infty}x[n]h_r(t - nT) +$$ + +如选择截止频率$\Omega_c = \pi/T$的理想低通滤波器: + +$$ +x_r(t) = \sum_{x = -\infty}^{\infty}x[n]\frac{\sin[\pi(t - nT)/T]}{\pi(t - nT)/T} +$$ +理想低通滤波器通过对冲激串信号的内插重建了原来的连续信号 + +**Summary** + +原信号: + +$$ +x_c(t) \leftrightarrow X_c(j\Omega) +$$ + +采样后的信号: + +$$ +\sum\limits_{n=-\infty}^{\infty}x[n]\delta(t - nT_s) = \sum\limits_{n=-\infty}^{\infty}x_c(t)\delta(t - nT_s) \leftrightarrow \frac{1}{T_s}X(e^{j\Omega T_s}) = \frac{1}{T_s}\sum\limits_{n=-\infty}^{\infty}X_c(j(\Omega - n\Omega_s)) +$$ + +数字域: + +$$ +x[n] \leftrightarrow X(e^{j\omega}) = \frac{1}{T_s} X_c(j\omega /T_s) +$$ + +恢复信号: +$$ +h_r(t) \leftrightarrow H_r(j\Omega) = \begin{cases} + T_s, &|\Omega| \le \pi / T_s, \\ + 0, &|\Omega| \gt \pi / T_s +\end{cases}\\ +\begin{align*} + x_r(t) &= \sum\limits_{n=-\infty}^{\infty}x[n]\delta(t - nT_s) * h_r(t)\\ + &= \sum\limits_{n=-\infty}^{\infty} x_c(nT_s)h_r(t - nT_s)\\ + &= x_c(t) +\end{align*}\ \leftrightarrow\ \begin{align*} + X_r(j\Omega) &= T_s X(e^{j\Omega T_s})H_r(j\Omega)\\ + &= X_c(j\Omega) +\end{align*} +$$ + +数字时域和模拟时域之间的关系: +$$ +n = \frac{t}{T_s} = tf_s +$$ + +数字频域和模拟频域之间的关系: +$$ +\omega = \Omega T_s = \frac{2\pi f}{f_s} +$$ + +## 信号的表示 + +### 离散信号的时域表示 +* 时域表示方法 + * 数学表达式:可表示基本信号,但大多数实际信号无解析表达式 + * 图形表示:直观、易理解,但不适用于刻画复杂信号 + * 数据表示:离散信号最一般的表示方法 + +### 离散信号的变换域表示 +* 定义:假设离散时间信号为𝑥[𝑛] ,定义映射𝑇{·},那么信号的变换域表示可以写作𝑋 = 𝑇{𝑥[𝑛]} + * 𝑇{·}是从函数空间到函数空间的映射 + * 𝑋并不要求一定定义在整数域上 +* 常用情形:级数表示 + * 将信号分解成有限项或无穷多项基本信号加权和的形式,由和式中每个基本信号的加权值组成的序列形成了原信号的变换域表示 + * 傅里叶级数展开 $x[n] = \sum_k a_k e^{j2\pi kn /T}$ + +### 离散信号的正交函数表示 + +- 使用信号空间的完备正交基来表示离散信号, +$$ +\lbrace\ldots ,\varphi_0[n] ,\varphi_1[n] ,\varphi_2[n] , \ldots\rbrace +$$ +- 正交性: +$$ +\sum_{n} \varphi_k^*[n] \varphi_l[n] = \delta_{kl} +$$ +其中,$k \neq l$。 +* 完备性 + * 任何一个信号都可由这组基函数通过线性叠加而构成 +* 加权系数的计算 + * 对基函数的投影: + +$$ +c_k = \frac{\langle x[n], \phi_k[n]\rangle}{||\phi_k[n]||^2} +$$ + +DFT 的定义如下: +$$ +X[k] = \sum_{n=0}^{N-1} x[n]e^{-j2\pi kn/N} +$$ +其中,$x[n]$为输入信号的离散样本,$N$为采样点数,$X[k]$为输出的频域样本。 + +DCT 的定义如下: +$$ +X[k] = \sum_{n=0}^{N-1} x[n]\cos\left(\frac{\pi}{N}(n + 0.5)k\right) +$$ +其中,$x[n]$为输入信号的离散样本,$N$为采样点数,$X[k]$为输出的频域样本。 + +### 离散信号的特征域(量)表示 +* 特征量表示指由信号的时域或频域表示来计算用 +于表征信号的特征量 + * 例如能量、功率、均值、相关函数、功率谱 + * 特征量表示通常是单向性的,由特征量表示一般不能完整地恢复原信号的所有取值 + * 实践中,经常用特征量来表示随机信号 + +### 离散信号的单位抽样信号表示: +单位抽样信号的移位作为基信号: +$$ +\varphi_k[n] = \delta[n - k], \quad k \in (-\infty, \ldots, -1, 0, 1, \ldots, \infty) +$$ + +• 正交性验证: +$$ +\langle\varphi_k[n],\varphi_l[n]\rangle = \sum_{n=-\infty}^{\infty} \delta[n - k] \delta[n - l] = \delta[k - l] +$$ + +• 系数计算: +$$ +c_k = \frac{\langle x[n],\varphi_k[n]\rangle}{\varphi_k[n]^2} = x[k] +$$ + +• 离散信号的单位抽样表示为: +$$ +x[n] = \sum_{k=-\infty}^{\infty} c_k\varphi_k[n] = \sum_{k=-\infty}^{\infty} x[k] \delta[n - k] +$$ + +离散信号的复指数信号表示如下: + +• 复指数信号作为基信号: +$$ +\varphi_\omega[n] = e^{j\omega n}, \quad 0 \leq \omega < 2\pi +$$ + +• 正交性验证: +$$ +\langle\varphi_{\omega_1}[n],\varphi_{\omega_2}[n]\rangle = \sum_{n=-\infty}^{\infty} e^{j\omega_1 n} e^{-j\omega_2 n} = \begin{cases} +0, & \omega_1 \neq \omega_2 \\ +\infty, & \omega_1 = \omega_2 +\end{cases} +$$ + +• 系数计算: +$$ +X(e^{j\omega}) = \langle x[n], e^{j\omega n} \rangle = x[n] e^{-j\omega n} +$$ + +• 离散信号的复指数信号表示为: +$$ +x[n] = \frac{1}{2\pi} \int_{-\pi}^{\pi} X(e^{j\omega}) e^{j\omega n} d\omega +$$ + +### 有限长离散信号的正交函数表示 + +• 对于长度为$N$的有限长离散序列,选择以下$N$个序列作为基信号: +$$ +\varphi_k[n] = e^{j\frac{2\pi}{N}kn}R_N[n], \quad k = 0,1,2,\ldots,N-1 +$$ + +• 正交性验证: +$$ +\langle \varphi_k[n],\varphi_l[n] \rangle = \sum_{n=0}^{N-1} e^{j\frac{2\pi}{N}(k-l)n} = \begin{cases} +N, & k = l \\ +0, & k \neq l +\end{cases} +$$ + +• 系数计算: +$$ +X[k] = \sum_{n=0}^{N-1} x[n] e^{-j\frac{2\pi}{N}kn}, \quad k = 0,1,2,\ldots,N-1 +$$ + +• 有限长离散序列可以表示为: +$$ +x[n] = \frac{1}{N} \sum_{k=0}^{N-1} X[k] e^{j\frac{2\pi}{N}kn}, \quad n = 0,1,2,\ldots,N-1 +$$ + +* 离散信号的因果性: + * 𝑥[𝑛] = 0,for 𝑛 < 0 + +因果连续信号抽样后一定是因果离散信号。 + +* 离散信号的对称性: + +• 共轭对称性: + - 正对称:$x[n] = x^*[-n]$ + - 反对称:$x[n] = -x^*[-n]$ + +• 任意信号都可以表示为奇分量和偶分量的和: + $x[n] = x_o[n] + x_e[n]$ + 其中,$x_o[n] = \frac{1}{2}(x[n] - x^*[-n])$为奇分量,$x_e[n] = \frac{1}{2}(x[n] + x^*[-n])$为偶分量。 + +• 若信号具有实因果性,可以通过奇分量或偶分量来恢复原信号: + +$$ +x[n] = \begin{cases} +0, & n < 0 \\ +x_e[n], & n = 0 \\ +2x_e[n], & n > 0 +\end{cases} +$$ + +* 离散信号的周期性: + * $𝑥[n] = 𝑥[𝑛 + N]$ + +周期连续信号均匀采样后**不**一定是周期离散信号。 + +$$ +\omega_0 = \Omega_0T = 2\pi\frac{T}{T_0} +$$ + +离散余弦信号的数字角频率 $\omega_0$ 由采样周期和连续信号周期的比值决定。该比值决定了采样后的信号是否具有周期性。 + + +### 离散系统的表示 + +离散系统的表示可以使用以下公式来描述: + +$$y[n] = \sum_{k=-\infty}^{\infty} h[k]x[n-k]$$ + +其中,$y[n]$表示系统的输出,$x[n]$表示系统的输入,$h[k]$表示系统的单位冲激响应。这个公式是卷积的离散形式,也称为离散卷积。 + +对于因果性,一个离散系统被称为因果性系统,如果它对任何$n < 0$的输入信号$x[n]$都产生$y[n] = 0$的输出。这意味着输出只依赖于当前和过去的输入。 + +对于稳定性,一个离散系统被称为稳定系统,如果对于有界的输入信号$x[n]$,输出$y[n]$仍然是有界的。 + +LTI(线性时不变)系统是指具有线性性质和时不变性质的系统。线性性质意味着系统满足叠加原理,即对于输入信号$x_1[n]$和$x_2[n]$,系统的输出满足$y_1[n] + y_2[n]$。时不变性质意味着系统的单位冲激响应$h[k]$与输入信号$x[n]$的延迟无关。 + +单位冲激响应是指当输入信号为单位冲激函数$\delta[n]$时,系统的输出。单位冲激响应通常用$h[n]$表示。 + +LTI系统可完全由单位冲激响应来表征。 + +因果性判据:单位冲激响应是一个因果信号。 +稳定性判据:$S = \sum_{k = -\infty}^\infty |h[k]| \lt +\infty$ + +**特征函数与特征值** + +$$ +T\lbrace s[n]\rbrace = \lambda s[n] +$$ + +**LTI系统的特征函数与特征值** + +$$ +T\lbrace e^{j\omega n}\rbrace =\sum\limits_{k=-\infty}^{\infty}h[k]e^{j\omega (n - k)} = \underbrace{e^{j\omega n}}_{特征函数}\cdot\underbrace{\sum\limits_{k=-\infty}^{\infty}h[k]e^{-j\omega k}}_{特征值} +$$ + +$y[n]$ 可看作 $x[n]$ 经过特征信号分解、加权、求和的结果: + +$$ +y[n] = \frac{1}{2\pi} \int_{-\pi}^\pi H(e^{j\omega})X(e^{j\omega})e^{j\omega n}\mathrm d\omega +$$ + +* 频率响应函数:单位冲激响应的DTFT + +$$ +H(e^{j\omega}) =\sum\limits_{n=-\infty}^{\infty}h[n]e^{-j\omega n} +$$ + +* 系统函数 + +$$ +H(z) =\sum\limits_{n=-\infty}^{\infty}h[n]z^{-n} +$$ + +* 系统差分方程 + +$$ +\sum\limits_{k=0}^{N} a_ky[n - k] =\sum\limits_{k=0}^{M} b_kx[n - k] +$$ + +* 系统状态空间 + +$$ +\lambda[n + 1] = A\lambda[n] + Bx[n]\\ +y[n] = C\lambda[n] + Dx[n] +$$ + +## DTFT 与 DFT + +### DTFT + +$$ +\begin{cases} + X(e^{j\omega}) =\sum\limits_{n=-\infty}^{\infty}x[n]e^{-j\omega n}\\ + x[n] = \frac{1}{2\pi} \int_{-\pi}^{\pi}X(e^{j\omega})e^{j\omega n}\mathrm d\omega +\end{cases} +$$ + +与连续频谱的关系: + +$$ +X(e^{j\omega}) = \frac{1}{T}\sum\limits_{k=-\infty}^{\infty}X_a\left[j\left(\frac{\omega}{T} - k\frac{2\pi}{T}\right)\right]\\ +\omega = \Omega T +$$ + +基本性质: + +* 周期性 + +$$ +X(e^{j\omega}) = X(e^{j\omega + 2k\pi}), k\in \Z +$$ + +* 线性 + +$$ +ax[n] + by[n] \lrarr aX(e^{j\omega}) + bY(e^{j\omega}) +$$ + +* 频域求导 + +$$ +nx[n] \lrarr j\frac{\mathrm dX(e^{j\omega})}{\mathrm d\omega} +$$ + +* Parseval 定理: + +$$ +\sum\limits_{n=-\infty}^{\infty}||x[n]||^2 = \frac{1}{2\pi}\int_{-\pi}^{\pi}||X(e^{j\omega})||^2\mathrm d\omega +$$ + +* 序列的调制 + +$$ +x[n]e^{j\omega_0 n} \lrarr X(e^{j(\omega - \omega_0)}) +$$ + +实现数字变频: + +$$ +x_B[n] = x[n]e^{-j\frac{\pi}{2}n} +$$ + +* 序列的平移 + +$$ +x[n - n_0] \lrarr e^{-j\omega n_0}X(e^{j\omega}) +$$ + +* 共轭对称性 + +$$ +x_e[n] \lrarr \text{Re}\lbrace X(e^{j\omega}) \rbrace +$$ + +$$ +x_o[n] \lrarr \text{Im}\lbrace X(e^{j\omega}) \rbrace +$$ + +下面是修正后的表格: + +| 序列 $x[n]$ | DTFT $X(e^{j\omega})$ | +|:------------:|:------------------:| +| $x[n]$ | $X(e^{j\omega})$ | +| $x^*[n]$ | $X^*(e^{-j\omega})$ | +| $x^*[-n]$ | $X^*(e^{j\omega})$ | +| $x_R[n]$ | $X_e(e^{j\omega})$ | +| $jx_I[n]$ | $X_o(e^{j\omega})$ | +| $x_e[n]$ | $X_R(e^{j\omega})$ | +| $x_o[n]$ | $jX_I(e^{j\omega})$ | +| 以下为实信号| | +| $x[n] = x^*[n]$ | ,$X(e^{j\omega}) = X^*(e^{-j\omega})$ | +| $x_e[n] = \frac{1}{2}(x[n] + x[-n])$ | $X_R(e^{j\omega})$ 实、偶函数| +|$x_o[n] = \frac{1}{2}(x[n] - x[-n])$| $jX_I(e^{j\omega})$ 虚、奇函数 | + +* 卷积与相关性质 + * 时域卷积: $x[n] * y[n] \lrarr X(e^{j\omega})\cdot Y(e^{j\omega})$ + * 频域卷积:$x[n] \cdot y[n] \lrarr \frac{1}{2\pi}X(e^{j\omega}) * Y(e^{j\omega})$ + * 时域相关: + * 互相关:$r_{xy}[k] =\sum\limits_{k=-\infty}^{\infty}x[n]y^*[n - k]$ + * 自相关:$r_{xx}[k] =\sum\limits_{k=-\infty}^{\infty}x[n]x^*[n - k]$ + * $R_{xy}(e^{j\omega}) = X(e^{j\omega}) \cdot Y^*(e^{j\omega})$ + * $R_{xx}(e^{j\omega}) = X(e^{j\omega}) \cdot X^*(e^{j\omega})$ + +**DTFT的存在条件:** + +取决于 $\sum\limits_{n=-\infty}^{\infty}x[n]e^{-j\omega n}$ 的收敛性 + +有限和序列 $X_N(e^{j\omega}) =\sum\limits_{n=-N}^{N}x[n]e^{-j\omega n}$ + +* 若 $x[n]$ 绝对可和,则 DTFT 存在,且一致收敛 +* 若序列满足平方可和,则 DTFT 满足均方收敛性 + * 截断误差的能量趋于0,但是某些点的误差的绝对值不一定趋于0(例如理想低通滤波器,有吉布斯现象,在截止频率附近存在一个独立于 $N$ 的震荡,即使 $N$ 趋于无穷,在某些频率点上还是存在9%左右的误差) + +**特殊信号的 DTFT** + +* 符号序列 + +$$ +\text{sgn}[n] = \begin{cases} + 1, &n\gt 0,\\ + 0, &n = 0\\ + -1, &n \lt 0 +\end{cases} \lrarr \text{SGN}(e^{j\omega}) = \frac{1}{j} \cot \left(\frac{\omega}{2}\right) +$$ + +* 阶跃序列 + +$$ +u[n] = \frac{1}{2}(\text{sgn}[n] + 1) + \frac{1}{2} \delta[n] \lrarr U(e^{j\omega}) = \frac{1}{1 - e^{-j\omega} + \pi} + \pi\sum\limits_{k=-\infty}^{\infty}\delta(\omega - 2\pi k) +$$ + +* 离散周期单位冲激串 + +$$ +x[n] =\sum\limits_{k=-\infty}^{\infty}\delta[n - kN]\lrarr X(e^{j\omega}) =\sum\limits_{k=-\infty}^{\infty}e^{-j\omega k N} = \frac{2\pi}{N}\sum\limits_{k=-\infty}^{\infty}\delta(\omega - \frac{2k\pi}{N}) +$$ + +离散时限信号与周期单位冲激串的卷积,在频域上表现为对 DTFT 的采样,这正是从 DTFT 到 DFT 的过渡。 + +### DFT + +DTFT给出了离散信号频域的全部信息,但在实际应用中存在如下困难: +* 实际信号往往没有解析表达式,无法计算其DTFT +* 实际物理装置只能采集有限长度的数据 +* DTFT给出的频谱是连续的,无法用数字设备记录和存储全部的值 + +#### DFT 的定义 + +$$ +\begin{cases} + X[k] =\sum\limits_{n=0}^{N - 1}x[n]W_N^{nk}, &k = 0, 1, 2, \dots, N - 1\\ + x[n] =\frac{1}{N}\sum\limits_{n=0}^{N - 1}x[n]W_N^{-nk}, &k = 0, 1, 2, \dots, N - 1\\ +\end{cases} +$$ + +其中, +$$ +W_N = e^{-j\frac{2\pi}{N}} +$$ + +#### 理解 DFT + +DFT 是 DTFT 的频域采样 + +$$ +X(e^{j\omega}) =\sum\limits_{n=-\infty}^{\infty}x[n]e^{j\omega n}\\ +X[k] = X(e^{j\omega})\big |_{\omega_k = \frac{2\pi}{N}k} =\sum\limits_{n=-\infty}^{\infty}x[n]e^{-j\frac{2\pi}{N}kn} +$$ + +* 频域乘积等价于时域卷积,因此对离散序列在频域上以2𝜋/𝑁为周期进行采样,等效于离散信号在时域上进行周期延拓,延拓周期为𝑁 + +* 为保证离散序列频域采样对应的时域序列不发生混叠,要求原离散序列为有限长且长度不超过𝑁。 + +#### DFT 的频域重构 + +* 首先需要 $N \ge L$ + +$$ +\begin{align*} + X(e^{j\omega}) &=\sum\limits_{n=0}^{N - 1}x[n]e^{-j\omega n} =\sum\limits_{n=0}^{N - 1}\bigg[\frac{1}{N}\sum\limits_{n=0}^{N - 1}X[k]e^{j\frac{2k\pi}{N}n}\bigg]e^{-j\omega n}\\ + &=\sum\limits_{k=0}^{N - 1}X[k]\bigg[\frac{1}{N}\sum\limits_{n=0}^{N - 1}e^{-j(\omega - \frac{2k\pi}{N}n)}\bigg]\\ + &=\sum\limits_{k=0}^{N - 1} X[k]P\bigg(\omega - \frac{2k\pi}{N}\bigg) +\end{align*} +$$ + +其中,内插函数 + +$$ +P(\omega) = \frac{1}{N}\sum\limits_{n=0}^{N - 1} e^{-j\omega n} = \frac{1}{N}\frac{\sin (\omega N / 2)}{\sin (\omega / 2)}e^{-j \frac{N - 1}{2}\omega} +$$ + +#### 理解 DFT II + +离散正交变换的定义: + +* 定义变换矩阵 $A$, 若 $A$ 满足 $A^HA = cI$,其中$c$为常数,则称 $X = Ax$ 为离散正交变换。若 $c = 1$,则称变换是归一化的。 +* 归一化的离散正交变换满足 Parseval 定理:$||X||^2 = X^HX = x^HA^HAx = x^Hx = ||x||^2$ + +DFT 是对离散时间信号的加权求和,其向量形式 + +* $X[k] = w_k^Hx$, $w_k = [e^{j\frac{2\pi0k}{N}}, e^{j\frac{2\pi1k}{N}}, \dots, e^{j\frac{2\pi(N - 1)k}{N}}]^T$ +* $X = [X[0], X[1], \dots, X[N - 1]]^T$,则有$X = [w_0, w_1, \dots, w_{N - 1}]^Hx = W_Nx$ + +$$ +X = W_Nx\\ +x = \frac{1}{N} W_N^HX +$$ + +#### DFT 的周期延拓 + +• DFT本意是用有限个离散频域样本来表示有限长离散序列 + +– 时域采样对应着频域周期延拓,频域采样对应着时域周期延拓 + +• 由于周期延拓,DFT总是面对着周期序列 + +– 在DFT计算和应用中,总是选择时域和频域的主值区间 + +– DFT这种隐含的周期性决定了其与DTFT具有不同的性质 + +**周期延拓的数学表示** + +$$ +\big((n)\big)_N +$$ + +周期延拓可以表示为: + +$$ +\tilde X[k] = X\bigg[\big((k)\big)_N\bigg] +\tilde x[n] = X\bigg[\big((n)\big)_N\bigg] +$$ + +也可表示为卷积和: + +$$ +\tilde{X}[k] = X[k] *\sum\limits_{m=-\infty}^{\infty}\delta[k - mN] =\sum\limits_{m=-\infty}^{\infty}X[k - mN]\\\tilde{x}[n] = x[n] *\sum\limits_{m=-\infty}^{\infty}\delta[n - mN] =\sum\limits_{m=-\infty}^{\infty}x[n - mN] +$$ + +#### DFT 性质 + +* 线性性 + * 前提:变换长度 $N$ 相同 + * 如果不相同,补零到长度 $N \ge \max(N_1, N_2)$ +* 反转性质:若时域循环反转,则频域循环反转 + * $\text{DFT} \Bigg\lbrace x\big[\big((-n)\big)_N\bigg] R_N[n]\Bigg\rbrace = X\bigg[\big((-k)\big)_N\bigg] R_N[k]$ + * 0 时刻不变,其余前后反转 +* 共轭性质:若时域共轭,则频域共轭且循环反转 + * $\text{DFT}\lbrace x^*[n]\rbrace = X^*[N - k]$ +* 对偶性质:序列的DFT的DFT + * $\text{DFT}\lbrace X[n]\rbrace = NX^*[N - k]$ +* 周期序列的共轭对称性: + * 共轭对称:$x_{ep}[n] = x^*_{ep}\bigg[\big((-n)\big)_N\bigg]$ + * 共轭反对称:$x_{ep}[n] = -x^*_{ep}\bigg[\big((-n)\big)_N\bigg]$ + * 任意有限长序列的周期延拓总可以分解为周期共轭对称和反对称的分量和的形式 + * $x[n] = x_{ep}[n] + x_{op}[n]$ + * $x_{ep}[n] = \frac12 (x[n] + x^*\bigg[\big((-n)\big)_N\bigg])$ + * $x_{op}[n] = \frac12 (x[n] - x^*\bigg[\big((-n)\big)_N\bigg])$ + * 实序列的DFT是周期共轭对称序列 + * 虚序列的DFT是周期共轭反对称序列 + * 周期共轭对称序列的DFT是实的 + * 周期共轭反对称序列的DFT是虚的 +* 循环卷积性质: + * 有限长循环移位的 DFT 可以由原序列 DFT 乘上一个线性的相位因子得到:$\text{DFT}\Bigg \lbrace\bigg[x\big((n - m)\big)_N\bigg]\Bigg \rbrace = X[k]e^{-j\frac{2\pi k}{N}m}$ + * 在 DTFT 中:$x[n] * y[n] = \text{IDTFT}\lbrace X(e^{j\omega}) \cdot Y(e^{j\omega})\rbrace$ + * DFT 中:$x[n] \circledast y[n] =\sum\limits_{m=0}^{N - 1}x[m]y\bigg[\big((n - m)\big)_N\bigg] =\sum\limits_{m=0}^{N - 1}x\bigg[\big((n - m)\big)_N\bigg]y[m]$ +* Parseval 定理: + * $\sum\limits_{n=0}^{N - 1}|x[n]|^2 = \frac{1}{N}\sum\limits_{k=0}^{N - 1}|X[k]|^2$ + +## FFT + +FFT 算法是一大类 DFT 快速算法的总称。 +* 基 2 FFT 算法:$N = 2^m$ +* 基 4 FFT 算法:$N = 4^m$ +* 分裂基算法:基本蝶形是倒 L 型,$N = 2^m$ +* 组合数 FFT 算法:变换点数为组合数,即$N = N_1N_2$ + +根据处理基本蝶形的结构特点,可以分为: +* DIT (Decimation-In-Time) +* DIF (Decimation-In-Frequency) + +### 基 2 DIT-FFT 算法 + +按照奇偶时间拆分成两个短序列。 + +长序列的 DFT 可以由两个短序列的 DFT 组合得到。 + +$$ +X[k] = \sum\limits_{m=0}^{N/2 - 1}x[2m]W_N^{2mk} + \sum\limits_{m=0}^{N/2 - 1} x[2m + 1]W_N^{(2m + 1)k}\\ +f_1[n] = x[2n], f_2[n] = x[2n + 1]\\ +X[k] = F_1[k] + W_N^kF_2[k]\\ +X[k + N/2] = F_1[k] - W_N^kF_2[k] +$$ + +反复抽取,变成2点 DFT: + +$$ +\begin{bmatrix} + X[0]\\ + X[1] +\end{bmatrix} = \begin{bmatrix} + x[0] + x[1]\\ + x[0] - x[1] +\end{bmatrix} +$$ + +![alt](../images/DSP/4_2.jpg) + +计算复杂度: +* 乘法次数为$\frac{N}{2}\log_2N$,$m_a = Nm = N\log_2 N$ + +输入和输出序列的顺序关系:二进制下的倒序关系。 +* 每次均分时,输入序列按照奇偶性划分,输出序列按照是否过半划分 +* 输入序列的奇偶性等价于最低位为1还是0,输出序列是否过半等价于最高位为1还是0 +* 因此输入映射到输出序列是低位映射到高位的关系。 + +## 数字频谱分析 + +### DFT 谱分析的基本概念 + +频谱:信号经过傅里叶变换转换到频域后,其频域表示的幅度和相位随频率变化的关系分别称为信号的幅度谱和相位谱 + +基于 DFT 的数字频谱分析 + + +利用离散信号 DFT 结果 $X[k]$ 与原连续信号频谱 $X_a(j\Omega)$ 之间存在对应关系来获得连续信号的频谱。 + +$$ +X[k] = X(e^{j\omega})|_{\omega = \frac{2\pi}{N}k} +$$ + +$$ +X(e^{j\omega}) = \frac{1}{T_s}X_a(j\Omega)|_{\Omega = \frac{\omega}{T_s}} +$$ + +$$ + X_a(j\Omega_k)= T_s X[k] +$$ + +利用 DFT 结果获得连续信号的频谱: + +$$ +X_a(j\Omega_k) = X_a \left ( j\frac{2\pi k}{NT_s} \right) = \begin{cases} + T_sX[k], 0 \le k \le \lceil \frac{N}{2} \rceil, \\ + T_sX[k + N], - \lceil \frac{N - 1}{2} \rceil\le k \lt 0 +\end{cases} +$$ + +基于DFT的频谱分析方法存在的问题 + +- 理论上连续正弦信号的频谱应为冲激函数,但DFT结果为有限值 +- DFT结果在连续正弦信号频谱幅度为0的位置却不为零 + +### DFT 谱分析的一般过程 + +#### 抗混叠滤波 + +![alt](../images/DSP/5_1.jpg) + +#### 采样 + +提高采样率 +- 优点:能够无混叠分析的信号带宽增大 +- 缺点:数据率提高,系统复杂度增加,成本上升 + +#### 加窗 + +由于DFT只能处理有限长序列,需要对输入信号 +通过加窗进行截断 +- 窗长可根据频率分辨率、实时性和设备存储能力的要 +求来权衡 +- 窗函数的形式也可根据主瓣宽度和旁瓣电平进行选择 + +$$ +w_R[n] = \begin{cases} + 1, 0 \le n \lt M\\ + 0, \text{others} +\end{cases} +$$ + +$$ +x_w[n] = x[n]w_R[n] +$$ + +#### DFT计算、插值及频谱输出 + +DFT计算 +- 可能需要补零,以获得更密集的频域采样,以及使变换点数𝑁满足FFT算法的要求(基2-FFT、基4-FFT) + +插值 +- 由DFT结果获得DTFT的估计值 +- 插值方法: + - 精确插值: $X(e^{j\omega}) =\sum\limits_{k=0}^{N - 1} X[k] P \left ( \omega - \frac{2\pi k}{N} \right)$, $P(\omega) = \frac{\sin(\omega N/2)}{\sin(\omega/2)}e^{-j\frac{N-1}{2}\omega}$ + - 近似插值:线性插值,二次插值 + +连续信号频谱输出 +– 通过坐标变换得到连续信号频谱 $X_a(j\Omega) = T_sX(e^{j\Omega T_s})$ + +### DFT 谱分析问题 + +#### 谱分析滤波器 + +$$ +s(t) = \frac{1}{2\pi} \int_{-\infty}^{\infty}S(j\Omega)e^{j\Omega t}\mathrm d\Omega\\ +s(nT_s) = \frac{1}{2\pi} \int_{-\infty}^{\infty}S(j\Omega)e^{j\Omega nT_s}\mathrm d\Omega\\ +x[n] = \begin{cases} + s(nT_s), n = 0, 1, \dots, M - 1,\\ + 0, M, M + 1, \dots, N - 1 +\end{cases}\\ +X[k] =\sum\limits_{n=0}^{N - 1}x[n]e^{-j\frac{2\pi nk}{N}} = \frac{1}{2\pi}\int_{-\infty}^{\infty}\sum\limits_{n=0}^{M - 1}e^{j(\Omega T_s - 2\pi k/N)n}\mathrm d\Omega +$$ + +令 $\theta = T_s(\Omega - \Omega_k)$, + +$$ +\varphi_k(M, \theta) = \sum\limits_{n=0}^{M - 1}e^{j(\Omega T_s - 2\pi k/N)n} = \frac{\sin(M\theta / 2)}{\sin(\theta/2)} e^{j\frac{M - 1}{2}\theta} +$$ + +梳状滤波特性 + +![alt](../images/DSP/5_2.jpg) + +周期内存在多个过零点,把滤波器响应分割成多个区间 +* 主瓣:谱分析滤波器频率响应最大的那个区间 +* 主峰:主瓣中最大频率响应点 $Ω = \frac{2\pi k}{NT_s}$处,高度为𝑀 +* 主瓣宽度:主瓣两边过零点之间的距离4𝜋⁄𝑀𝑇𝑠 +* 旁瓣:除响应最大的那个区间外的其它区间 + +DFT频谱分析方法能否反映连续信号的频谱? +- DFT的结果主要给出了连续信号落在相应谱分析滤波器主瓣内的那部分信号的频域信息 +- 由于相邻谱分析滤波器主瓣间有交叠,同一个信号可能会在相邻两个谱分析滤波器都有响应 +- 谱分析滤波器的旁瓣会在其他谱分析滤波器的主瓣位置出现,其对应的DFT结果不可避免的包含了其他滤波器主瓣位置处的信号成分 + +DFT 可用于连续信号的频谱分析,但由于其谱分析滤波器频率分割不理想的本质,必须对其输出结果进行小心的解释 + +DFT谱估计得到的是对加窗后序列DTFT的采样 + +$$ +x_w[n] = x[n]w_R[n]\\ +X_w(e^{j\omega}) = \frac{1}{2\pi}\int_{-\pi}^{\pi}X(e^{j\omega})W_R(e^{j(\omega - \theta)})\mathrm d\theta +$$ + +对于矩形窗: + +$$ +W_R(e^{j\omega}) = \text{DTFT}(w_R[n]) = \frac{\sin(M\omega / 2)}{\sin(\omega/2)} e^{-j\frac{M - 1}{2}\omega} +$$ + +频率分辨力的定义:两个等幅单频信号能够被区分开的最小频率间隔 + +矩形窗的主瓣宽度为 $4\pi/MT_s$ + +实际工程中,采用 3dB带宽并加上适当余量作为频率分辨力 + +* 矩形窗的数字角频率分辨力为 $\Delta \omega = 2\pi / M$ +* 连续信号的分辨力为 $\Delta f = f_s/M$ + +分辨力仅决定于信号时长 $MT_s$。 + +混叠效应 + +混叠效应本质上由采样过程引起 +- 混叠效应带来的问题 +- 如果采样过程带来了混叠,DFT结果无法将已混叠的频 +率分量分开 +- 采样之前作抗混叠滤波,把带外频率成分滤除 +- 增大采样频率(减小采样周期) +– 无法仅从DFT结果中判读原连续信号的模拟频率 +- 需要原连续信号频率分布或抗混叠滤波通带的先验 +知识 + +栅栏效应 +* DFT 无法精确表示不在离散采样点的频率值 +* 频率估计的最大误差为 $\pi / N$ +* 可以通过加窗补零(增大 $N$)的方法改善 +* 通过局部插值的方法获得更精确的频率估计:精确插值,线性插值,二次插值 + +## DFT 的应用 + +### 线性卷积的计算 + +假设有限长因果序列 $h[n]$ 和 $x[n]$,长度分别为 $P$ 和 $L$,均扩展到 $N$ 个点进行卷积 + +* 当 $N \ge P + L - 1$ 时,两种卷积的结果相等 +* 当 $N \lt P + L - 1$ 时,循环卷积出现混叠 + +基于 DFT 的 FIR 滤波器实现 + +FIR 滤波器需要计算有限长序列和无限长序列的线性卷积 +* $h[n]$ 有限 +* $x[n]$ 无限 + +方法1:重叠相加法 + +$$ +x[n] =\sum\limits_{r=0}^{\infty}x_r[n - rL]\\ +y[n] = h[n] * \sum\limits_{r=0}^{\infty}x_r[n - rL] = \sum\limits_{r=0}^{\infty}h[n] * x_r[n - rL]\\ +$$ + +整个序列的线性卷积等于各段线性卷积后的移位加和 + +IDFT 后,需要一个专门的加法器进行重叠部分的相加运算 + +方法二:重叠保留法 + +取 $L$ 点 $x[n]$ 与扩展的 $P$ 点 $h[n]$ 做循环卷积,取结果的后 $L - P + 1$ 个点作为结果。 + +两种方法、直接计算线性相关的计算量对比? + +### 线性调频 z 变换 + +CZT 的定义 + +$$ +X_{cz}(z)|_{z = z_k} =\sum\limits_{n=0}^{N - 1}x[n]z_k^{-n}\\ +z_k = AW^{-k} = (A_0e^{j\theta_0})(W_0e^{-j\varphi_0})^{-k} +$$ + +一种广义的 DFT,在复平面螺旋线上的采样。 + +CZT 的计算 +* 利用定义直接计算 +* 利用卷积计算,而卷积可以利用 FFT 计算 + +$$ +X_{cz}(z_k) = W^{\frac{k^2}{2}}\sum\limits_{n=0}^{N - 1}f[n]h[k - n]\\ +f[n] = x[n]A^{-n}W^{\frac{n^2}{2}}\\ +h[n] = W^{-\frac{n^2}{2}} +$$ + +### 短时傅里叶变换 + +问题:基于傅里叶的频谱分析可以指导信号观测窗内的频率成分,但是无法得知这些频率成分何时出现,何时消失,持续多久 + +定义 + +$$ +\text{STFT}(t^\prime, \Omega) = \int_{-\infty}^{\infty}x(\tau)g^*(\tau - t^\prime)e^{-j\Omega\tau}\mathrm d\tau +$$ + +* 窗的长度 + * 窗长需要足够短,确保落入窗的信号近似平稳 + * 窗越长,频率分辨率越高,窗越短,时间分辨率越高 + * 窗无限长,退化成 FT + * 无限短,退化成 $s(t^\prime)e^{-j\Omega t^\prime}$ +* 窗的类型 + * 矩形窗,汉明窗,布莱克曼窗 + * 主瓣宽度与旁瓣电平之间的权衡 + +不确定性原理 + +$$ +\Delta t \cdot \Delta \Omega \ge \frac{1}{2} +$$ + + +## LTI 系统 + +### LTI 系统的时域分析——冲激响应 + +根据冲激响应长度不同: +* FIR:用 $h[n]$ 表示系统 +* IIR:用系统函数或者差分方程表示 + +### LTI 系统的时域分析——冲激响应 + +复指数序列是 LTI 系统的特征函数 + +$$ +T \lbrace e^{j\omega n} \rbrace = H(e^{j\omega})e^{j\omega n} +$$ + +频率响应函数的表示方式 +* $H(e^{j\omega}) = H_R(e^{j\omega}) + jH_I(e^{j\omega})$ +* $H(e^{j\omega}) = |H(e^{j\omega})|e^{j\angle H(e^{j\omega})}$ +* 幅频特性: + * $|H(e^{j\omega})|$ + * $20\log |H(e^{j\omega})|$,单位 dB +* 相频特性 + * $arg(H(e^{j\omega}))$:连续相位 + * $Arg(H(e^{j\omega}))$:主值相位 + * 无卷绕相位:$\angle H(e^{j\omega}) = \tan^{-1}\frac{H_I(e^{j\omega})}{H_R(e^{j\omega})}$ + * 定义主值区间 $arg(H(e^{j\omega})) = ARG[H(e^{j\omega})] + 2\pi r(\omega)$,$r(\omega)$是补偿函数,仅取整数 + +相位延迟 + +群延迟 + +$$ +-\frac{\mathrm d}{\mathrm d\omega}\text{arg}[H_{id}(e^{j\omega})] +$$ + +可以表征窄带信号的相位失真(或者延迟) + +$$ +x[n] = a[n]e^{j\omega_c n}\\ +a[n] = c_1e^{j\omega_1n}\\ +y[n] \approx |H(e^{j\omega_c})|c_1e^{j(\omega_1 + \omega_c)n + j\varphi(\omega_1 + \omega_c)} \approx |H(e^{j\omega_c})|\underbrace{a[n - \tau_g(\omega_c)]}_{群延迟给出了包络延迟}\underbrace{e^{j\omega_c[n - \tau_p(\omega_c)]}}_{相位延迟\tau_p(\omega_c) = \varphi(\omega_c)} +$$ + +### LTI 系统的零极点分析 + +$$ +\sum\limits_{k=0}^{N}a_ky[n - k] =\sum\limits_{k=0}^{M}b_kx[n - k]\\ +H[z] = \frac{\sum\limits_{k=0}^{M}b_kz^{-k}}{\sum\limits_{k=0}^{N}a_kz^{-k}} = \left ( \frac{b_0}{a_0} \right)\frac{\prod_{k = 1}^M(1 - c_kz^{-1})}{\prod_{k = 1}^N(1 - d_kz^{-1})} +$$ + +$z = 0, z = \infty$ 也可能是零点!求解的时候不要忘了。 + +系统稳定性的条件:绝对可和。或者说 $H(z)$ 的极点在单位圆内。 + +可逆性的条件:$h[n] * h_i[n] = \delta[n]$, $H(8z)H_i(z) = 1$ +* 逆系统的极点和零点就是原系统的零点和极点 +* 逆系统和原系统必须有重叠的 ROC,因此可以确定逆系统的 ROC + +频率响应 + + +群延迟 + +$$ +\text{grd}[] =\sum\limits_{k=1}^{N}\frac{|d_k|^2 - \Re{d_ke^{-j\omega}}}{1 + |d_k|^2 - 2\Re{d_ke^{-j\omega}}} - \sum\limits_{k=1}^{M}\frac{|c_k|^2 - \Re{c_ke^{-j\omega}}}{1 + |c_k|^2 - 2\Re{c_ke^{-j\omega}}} +$$ + +### IIR滤波器 + +$$ +y[n] =\sum\limits_{k=1}^{N}a_ky[n - k] +\sum\limits_{k=0}^{M}b_kx[n - k]\\ +H(z) = \frac{\sum\limits_{k=0}^{M}b_kz^{-k}}{1 -\sum\limits_{k=1}^{N}a_kz^{-k}} +$$ + +直接 I 型 + +直接 II 型:交换次序,合并延迟单元 + +级联形式: + +$$ +H(z) = K \prod_{k = 1}^{N_s} \frac{b_{0k} + b_{1k}z^{-1} + b_{2k}z^{-2}}{1 - a_{1k}z^{-1} - a_{2k}z^{-2}} +$$ + +考虑到有限字长效应,级联形式可以以更加灵活的方式减小有限字长的影响。可以控制零点和极点的位置。 + +级联形式也可以用直接 I, II 型实现。 + +多径衰落就是一个 FIR 滤波器,因此具有频率选择特性。 + + +并联形式 + +$$ +H(z) =\sum\limits_{k=0}^{N_p}C_kz^{-k} +\sum\limits_{k=1}^{N_2}\frac{e_{0k}+e_{1k}z^{-1}}{1 - a_{1k} - a_{2k}z^{-2}} +$$ + +各子系统的计算误差互不影响,防止误差传递和放大,可控极点位置 + +流图转置定理:支路方向取反,系数不变,输入和输出交换位置 + +### FIR 滤波器 + +$$ +H(z) =\sum\limits_{n=0}^{N - 1}h[n]z^{-n} +$$ + +抽头延迟线 or 横向滤波器结构 + +具有转置形式 + +级联形式 + +$$ +H(z) = \prod_{k = 1}^{M_1}(f_{0k} - f_{1k}z^{-1}\prod_{k = 1}^{M_2}(b_{0k} + b_{1k} z^{-1} + b_{2k}z^{-2}) +$$ + +线性相位特性 + +$$ +H(e^{j\omega}) = A(e^{j\omega})e^{-j\omega\alpha} +$$ + +$$ +h[n] = h[M - n] (I, II)\\ +h[n] = - h[M - n] (III,IV) +$$ + +线性相位 FIR 滤波器的直接形式 + +偶数 + +$$ +y[n] = \begin{cases} + \sum\limits_{k=0}^{M/2 - 1}h[k](x[n - k] + x[n - M + k]) + h[M/2]x[n - M/2], &I type + \sum\limits_{k=0}^{M/2 - 1}h[k](x[n - k] - x[n - M + k]), &III type +\end{cases} +$$ + +奇数 + + +$$ +y[n] = \begin{cases} + \sum\limits_{k=0}^{(M - 1)/2}h[k](x[n - k] + x[n - M + k]), &II type + \sum\limits_{k=0}^{(M - 1)/2}h[k](x[n - k] - x[n - M + k]), &IV type +\end{cases} +$$ + +级联形式 + +对应四种零点分布情况,有四种网络结构 + +$$ +H(z) = 1 \pm z^{-1}\\ +H(z) = 1 - 2\cos(\theta)z^{-1} + z^{-2}\\ +H(z) = (1 - rz^{-1})(1 - r^{-1}z^{-1})\\ +H(z) = 1 + bz^{-1} + cz^{-2} + bz^{-3} + z^{-4} +$$ + +### FIR 滤波器的频率取样结构 + +$$ +H(z) =\sum\limits_{n=0}^{N - 1}h[n]z^{-n} = \frac{1}{N}(1 - z^{-N})\sum\limits_{k=0}^{N - 1}\frac{H(k)}{1 - W_N^{-j}z^{-1}} +$$ + +$H(k)$ 是 FFT 变换。 + +若冲激响应是实序列,可以用共轭对称性将成对的一阶子系统合称为二阶子系统 + +$$ +H_k(z) + H_{-k}(z) = 2|H(k)| \frac{\cos\theta(k) - (\cos(\theta(k) - \frac{2\pi}{N}k))z^{-1}}{1 - 2\cos(\frac{2\pi}{N}k)z^{-1} + z^{-2}} +$$ + +其中 $\theta(k)$ 是 $H(k)$ 的相位 + +不成对的子系统? + +$$ +H_0(z) = \frac{H(0)}{1 - z^{-1}}\\ +H_{N/2}(z) = \frac{H(0)}{1 + z^{-1}} +$$ + +FIR 滤波器的时分复用结构 + + +## 离散希尔伯特变换 + +$$ +h[n] = \begin{cases} + \frac{1 - \cos(n\pi)}{n\pi}, n \ne 0\\ + 0, n = 0 +\end{cases} +$$ + +## 典型数字信号处理系统及其误差源 + +* 引起有限字长的误差源 + * AD 变换引入的误差 + * 有限精度引起的误差 + * 限制乘法运算位数的误差 + * 防止加法溢出压缩信号电平的误差 + +### 量化误差的统计分析模型 + +$$ +Q_B \lbrace x[n] \rbrace = x[n] + e[n]\\ +$$ + +$e[n]$ 是各态历经的平稳随机序列,与 $x[n]$ 相互统计独立,具有白噪声的性质,不同时刻的取值相互独立,是均匀分布的。 \ No newline at end of file diff --git a/blitherboom-blog/pages/posts/Introduction-to-Probability.md b/blitherboom-blog/pages/posts/Introduction-to-Probability.md new file mode 100644 index 00000000..558a61d1 --- /dev/null +++ b/blitherboom-blog/pages/posts/Introduction-to-Probability.md @@ -0,0 +1,1907 @@ +--- +title: Introduction-to-Probability +date: 2023-02-20 21:05:41 +tags: note +katex: true +--- + +## Introduction + +## Probability Space + +Probability space is a triple $(\Omega, \mathcal{F}, \mathbf{P})$, comprised of the following three +elements: + +1 Sample space $\Omega$: the set of all possible outcomes of an experiment + +2 $\sigma$-algebra (or $\sigma$-field) $\mathcal F$: a collection of subsets of $\Omega$ + +3 Probability measure $\mathbf P$: a function that assigns a nonnegative +probability to every set in the $\sigma$-algebra $\mathcal F$ + +### Sample space +Mutually exclusive: no identical element. + +Collectively exhaustive: all results should be included. + +### $\sigma$-algegra + +not unique + +3 requirements: + +$$ +\varnothing \in \mathcal F\\ +\forall A \in \mathcal F, A^c \in \mathcal F\\ +\forall A_k \in \mathcal F, k=1, 2, ..., +\cup_{k=1}^{\infty}A_k\in \mathcal F +$$ + +### Borel field + +used to measure intervals + +when $\Omega$ is continuous($\R$ for example), Borel field is useful. + +"minimum" $\sigma$-algebra means deleting any element in the $\mathcal B (\mathbf R)$ will miss the requirements. + +![](../images/prob/L2_1.jpg) + +### Uncountable + +decimal numbers between 0 and 1 are uncountable. + +### Probability measures + +$$ +P:\mathcal F \rightarrow [0, 1] +$$ + +**Nonnegativity** $P(A)\ge0, \forall A \in \mathcal{ F}$ + +**Normalization** $P(\empty)=0, P(\Omega)=1$ + +**Countable additivity** $A_1, A_2, ... \text { is disjoint in }\mathcal F, P(A_1\cup A_2\cup ...)=P(A_1)+P(A_2)+...$ + +* They are the axioms of probability. +* Probability is a mapping from $\sigma$-algebra to a real number betwenn 0 and 1, which intuitively specifies the "likelihood" of any event. +* There exist non-measurable sets, on which we cannot define a probability measure. + +### Discrete models + +$$ +P(\{s_1, ..., s_n\})=P(s_1)+...+P(s_n)\\ +P(A) = \frac{\text{\# of elements of }A}{\text{total \# of elements of sample points}} +$$ + + +### Continuous Models + +Probability = Area + +### Some properties of Probability measure + +$$ +A\sub B\Rightarrow P(A)\le P(B)\\ +P(A\cup B)=P(A)+P(B)-P(A\cap B)\\ +P(A\cup B) \le P(A) + P(B)\\ +P(A\cup B \cup C)=P(A) + P(A^C\cap B) + P(A^C\cap B^C\cap C) +$$ + +### Conditional Probability + +$$ +P(A|B)=\frac{P(A\cap B)}{P(B)} +$$ + +* If $P(B)=0$, $P(A|B)$ is undefined. +* For a fixed event $B$, $P(A|B)$ can be verified as a legitimate probability measure on the new universe. $P(A, B)\ge 0$, $P(\Omega|B)=1$, $P(A_1\cup A_2\cup...|B)=P(A_1|B)+P(A_2|B)+...$ +*
$P(A|B)=\frac{\text{ \# of elements of }A\cap B}{\text{total \# of elements of }B}$
+ +### Total probability theorem + +Let $A_1, ..., A_n$ be disjoint events that form a partition of the sample space and assume that $P(A_i)>0$ for all $i$. Then for any event B, we have + +$$ +P(B) = \sum_{i=1}^n P(A_i\cap B) = \sum_{i=1}^nP(A_i)P(B|A_i) +$$ + +**Remark** +* The definition of partition is that $\cup_{i=1}^n A_i = \Omega, A_i\cap A_j = \emptyset, \forall i\ne j$ +* The probability of B is a weighted average of its conditional probability under each scenario +* Each scenario is weighted according to its prior probability +* Useful when $P(B|A_i)$ is known or easy to derive + +### Inference and Bayes' rule + +Let $A_1, ..., A_2$ be disjoint events that from a partition of the sample space and assume that $P(A_i) \gt 0$ for all $i$. Then for any event $B$ such that $P(B)\gt 0$, we have + +$$ +P(A_i|B) = \frac{P(A_i)P(B|A_i)}{P(B)} = \frac{P(A_i)P(B|A_i)}{\sum_{j=1}^nP(A_j)P(B|A_j)} +$$ + +**Remarks** +* Relates conditional probabilities of the form $P(A_i|B)$ with conditional probabilities of the form $P(B|A_i)$ +* often used in inference: effect $B$ $\lrarr$ cause $A_i$ + +The meaning of $P(A_i|B)$ in the view of Bayes: the belief of $A_i$ is revised if we observed effect $B$. If the cause and the effect are closely binded($P(B|A_i) > P(B|A_i^c)$), then the belief $A_i$ is enhanced by the observation of effect $B$($P(A_i|B) > P(A)$). This can be derived from the Bayes' rule through simple calculation. If $P(A_i|B)=P(A_i)$, then $B$ provides no information on $A_i$. + +### Independence + +#### Independence of two disjoint events + +Events A and B are called **independent** if +$$ +P(A\cap B) = P(A)\cdot P(B) +$$ +or equivalently, when $P(B) > 0$, + +$$ +P(A|B) = P(A) +$$ + +**Remarks** +* Occurrence of B provides no information about A's occurrence +* Equivalence due to $P(A\cap B) = P(B)\cdot P(A|B)$ +* Symmetric with respect to $A$ and $B$. +* - applies even if $P(B) = 0$ +* - implies $P(B|A) = P(B)$ and $P(A|B^c) = P(A)$ +* Does not imply that A and B are disjoint, indeed opposite! +* - Two disjoint events are never independent!($P(A\cap B) = 0$, but $P(A)\cdot P(B)\ne 0$) + +#### Conditional independence + +$$ +P(A\cap B | C) = P(A| C) \cdot P(B|C) +$$ + +**Definition** + +Event $A_1, A_2, ..., A_n$ are called independent if: + +$$ +P(A_i\cap A_j\cap ...\cap A_q) = P(A_1)P(A_j)...P(A_q) +$$ + +for any distinct indices $i, j, \dots q$ chosen from $\{1, \dots n\}$. + +Pairwise is independence does not imply independence. + +## Discrete Random Variables + +Random Variable is neither random, nor variable. + +### Definition + +We care about the probability that $X \le x$ instead $X = x$ in the consideration of generality. + +**Random variables** + +Given a probability space $(\Omega, F, P)$, a random variable is a function $X: \Omega \rightarrow \R$ with the probability that $\{\omega \in \Omega: X(\omega) \le x\} \in \mathcal F$ for each $x\in \R$. Such a function $X$ is said to be $\mathcal F$-measurable. + +**Probability Mass Function(PMF)** + +$$ +p_X(x)=P(X=x)=P(\{\omega \in \Omega \text{ s.t. } X(\omega)=x\}) +$$ + +Bonulli PMF: + +$$ +p_X(k) = \begin{cases} + p, &\text{if } k = 1\\ + 1-p, &\text{if }k=0 +\end{cases} +$$ + +Binomial PMF: $p_X(k)=\binom{n}{k}p^k(1-p)^{n-k}$ + +Geometric PMF: $p_X(k)=(1-p)^{k-1}p$ + +Poisson PMF: $p_X(k)=e^{-\lambda}\frac{\lambda^k}{k!}$. Note: $\sum_{k=0}^\infty e^{-\lambda}\frac{\lambda^k}{k!}=e^{-\lambda}e^\lambda=1$ + +If $y=g(x)$, $p_Y(y)=\sum_{\lbrace x|g(x)=y \rbrace} p(x)$. + + +### Expectation and Variance + +**Expectation** + +$$ +E[X] = \sum_x xp_X(x) +$$ + +Note: we assume that the sum converges. + +Properties: + +$$ +E[Y]=\sum_x g(x)p_X(x)\\ +E[\alpha X + \beta] = \alpha E[X] + \beta +$$ + +**Variance** + +$$ +\text{var}(X) = E \left[(X-E[X])^2\right]=\sum_x (x-E[X])^2 p_X(x) +$$ + +Standard deviation: $\sigma_X=\sqrt{\text{var}(X)}$ + +Properties: + +$$ +\text{var}(X) = E[X^2] -(E[X])^2\\ +\text{var}(X)\ge 0\\ +\text{var}(\alpha X + \beta) = \alpha^2\text{var} (X) +$$ + +**Bernoulli RV** + +$$ +p_X(k) = \begin{cases} + p, &\text{if } k = 1\\ + 1-p, &\text{if }k=0 +\end{cases}\\ +E[X] = p\\ +E[X^2] = p\\ +\text{var}(X) = p(1-p) +$$ + +**Discrete Uniform RV** + + +$$ +p_X(k) = \begin{cases} + \frac {1}{b-a+1}, &\text{if } k = a, a+1, ..., b\\ + 0, &\text{otherwise} +\end{cases}\\ +E[X] = \frac{a+b}{2}\\ +\text{var}(X) = \frac{(b-a)(b-a+2)}{12} +$$ + +**Poisson RV** + +$$ +p_X(k)=e^{-\lambda}\frac{\lambda^k}{k!}\\ +E[X] = \lambda\\ +\text{var}(X)=\lambda +$$ + +### Conditional + +$$ +p_{X|A(x)} = P(X=x|A) = \frac{P(\{X=x\}\cap A)}{P(A)} +$$ + +$$ +\sum_x p_{X|A}(x) = 1 +$$ + +$$ +E[X|Y=y] = \sum_x xp_{X|Y}(x|y)\\ +E[g(X)|Y=y] = \sum_x g(x)p_{X|Y}(x|y) +$$ + +**Total expectation theorem** + +$A_1, \dots, A_n$ is a partition of sample space + +$$ +P(B) = P(A_1)P(B|A_1) + \dotsb + P(A_n)P(B|A_n)\\ +p_X(x) = P(A_1)p_{X|A_1}(x) + \dotsb + P(A_n)p_{X|A_n}(x)\\ +E[X] = P(A_1)E[X|A_1] + \dotsb + P(A_n)E[X|A_n] +$$ + +We derive the expectation and variance use the theories above. + +**Geometric PMF example** + +$$ +p_X(k) = (1-p)^{k-1}p, k = 1, 2, \dots\\ +E[X] = \sum_{k=1}^\infty kp_X(k) = \sum_{k=1}^\infty k(1-p)^{k-1}p\\ +E[X^2] = \sum_{k=1}^\infty k^2p_X(k) = \sum_{k=1}^\infty k^2(1-p)^{k-1}p\\ +\text {var}(X) = E[X^2] - (E[X])^2 +$$ + +However, the Geometric has a memoryless property. + +$$ +p_{X|X>1}(k) = \frac{P(\{X>1\}\cap \{X=k\})}{P(X>1)} = \frac{(1-p)^{k-1}p}{1-p} = (1-p)^{k-2}p +$$ + +Thus, +$$ +E[X] = P(X=1)E[X|X=1] + P(X>1)E[X|X>1]=p+(1-p)(E[1 + X])\\ +\Rightarrow E[X] = 1/p\\ +E[X^2] = P(X=1)E[X^2|X=1] + P(X>1)E[X^2|X>1] = p + (1-p)E[(1+X)^2]=p + (1-p)(1+2E[X]+E[X^2])\\ +\Rightarrow E[X^2] = \frac{2-p}{p^2}\\ +\Rightarrow\text{var} (X) = \frac{1-p}{p^2} +$$ + +### Multiple discrete random variables + +**Joint PMFs** + +$$ +p_{X, Y}(x, y) = P(X = x, Y= y) = P(\{X(\omega) = x\}\cap \{Y(\omega) = y\}) +$$ + +$$ +\sum_x\sum_y p_{X, Y}(x, y) = 1 +$$ + +**Marginal PMF** + +$$ +p_X(x) = \sum_y P(X=x, Y=y) = \sum_y p_{X, Y}(x, y) +$$ + +**Conditional PMF** + +$$ +p_{X|Y}(x|y) = P(X = x | Y = y) = \frac{p_{X, Y}(x, y)}{p_Y(y)} +$$ + +$$ +\sum_x p_{X|Y}(x|y) = 1 +$$ + +**Funcitons of multiple RVs** + +$$ +Z = g(X, Y)\\ +p_Z(z) = \sum_{\lbrace (x, y)|g(x, y)=z \rbrace } p_{X, Y}(x, y) +$$ + +**Expectations** + +$$ +E[g(X, Y)] = \sum_x\sum_y g(x, y)p(X, Y)(x, y)\\ +E[g(X, Y, Z)] = \sum_x\sum_y\sum_z g(x, y, z)p(X, Y, Z)(x, y, z) +$$ + +$$ +E[g(X, Y)] \not\equiv g(E[X], E[Y]) +$$ + +**linearity** + +$$ +E[\alpha X + \beta] = \alpha E[X] + \beta\\ +E[X + Y + Z] = E[X] + E[Y] + E[Z] +$$ + +Let's calculate the Mean of Binominal RV. + +$$ +X_i= +\begin{cases} + 1, &\text{if success in trial } i,\\ + 0, & \text{otherwise.} +\end{cases}\\ +X = X_1 + X_2 + \dotsb X_n\\ +E[X] = \sum_{i = 1}^n E[X_i] = np\\ +\text{var}(X) = np(1-p) +$$ + +### Independence + +**Independence** + +$$ +p_{X, Y}(x, y) = p_X(x) \cdot p_Y(y) +$$ + +if $X$ and $Y$ are independent: + +$$ +E[XY] = E[X]E[Y]\\ +E[g(X)h(Y)] = E[g(X)]E[h(Y)]\\ +\text{var}(X + Y) = \text{var}(X) + \text{var}(Y) +$$ + +**Conditional independence** + +$$ +p_{X, Y|A}(X, Y) = p_{X|A}(x) \cdot p_{Y|A}(y) +$$ + +## Continuous Random Variables + + +### Probability Density Function + +* $f_X(x)\ge 0\text{ for all }x$ +* $\int_{-\infty}^\infty f_X(x)\mathrm dx = 1$ +* If $\delta$ is very small, then $P([x, x+\delta])\approx f_X(x) \cdot \delta$ +* For any subset $B$ of the real line, $P(X\in B) = \int_B f_X(x)\mathrm d x$. + +**Expectation** + +$$ +E[X] = \int_{-\infty}^\infty xf_X(x)\mathrm dx\\ +E[g(x)] = \int_{-\infty}^\infty g(x)f_X(x)\mathrm dx +$$ + +Assuming that the integration is well-defined. The Cauchy distribution ($\frac{1}{1+x^2}$)doesn't have expectation since $\frac{x}{1+x^2}$ is not absolutely integrably. + +**Variance** + +$$ +\text{var}(X) = E[(X - E[X])^2] = \int_{-\infty}^\infty(x - E[x])^2 f_X(x)\mathrm dx\\ +0\le \text{var}(x) = E[X^2] - (E[X])^2 +$$ + +**Uniform RV** + +$$ +f_X(x) = \begin{cases} + \frac{1}{b-a}, &\text{if }a\le x\le b,\\ + 0, &\text{otherwise.} +\end{cases} +$$ + +$$ +E[X] = \frac{a+b}{2}\\ +E[X^2] = \frac{a^2+b^2 + ab}{3}\\ +\text{var}(X) = \frac{(b-a)^2}{12} +$$ + + +Properties: + +$$ +E[aX+b] = aE[X] + b\\ +\text{var}(aX+b) = a^2\text{var}(X) +$$ + +### Common Example for PDF + +**Exponential Random Variable** + +$$ +f_X(x) = \begin{cases} + \lambda e^{-\lambda x}, &\text{if }x \ge 0,\\ + 0, &\text{otherwise.} +\end{cases} +$$ + +$$ +P(X\ge a) = e^{-\lambda a}\\ +E[X] = \frac{1}{\lambda}\\ +\text{var}(X) = \frac{1}{\lambda^2} +$$ + +### Cumulative Distribution Functions + +$$ +F_X(x) = P(X\le x) = \begin{cases} + \sum_{k\le x}p_X(k), &\text{if } X \text{ is discrete,}\\ + \int_{-\infty}^x f_X(t)\mathrm dt, &\text{if } X \text{ is continuous.} +\end{cases} +$$ + +**Properties** + +$$ +\text{if } x \le y, \text{then } F_X(x)\le F_X(y).\\ +F_X(x)\text{ tends to 0 as } x \rightarrow -\infty, \text{and to 1 as} x \rightarrow \infty\\ +\text{If } X \text{ is discrete, then } F_X(x) \text{ is a piecewise constant function of }x.\\ +\text{If } X \text{ is continuous, then } F_X(x) \text{is a continuous funciton of }x.\\ +\text{If } X \text{ is discrete and takes integer values, the PMF and the CDF can be obtained from each other by summing or differcing: }\\ +F_X(k) = \sum_{i = -\infty}^k p_X(i),\\ +p_X(k) = P(X\le k) - P(X \le k -1) = F_X(k) - F_X(k - 1),\\ +\text{ for all integers }k.\\ +\text{If } X \text{ is continuous, the PDF and the CDF can be obtained from each other by integration or differentiation: }\\ +F_X(x) = \int_{-\infty}^x f_X(t)\mathrm dt, f_X(x) = \frac{\mathrm dF_X}{\mathrm dx}(x) +$$ + +### Examples for CDF + +**Geometric CDF** + +$$ +F_{\text{geo}}(n) = \sum_{k = 1}^n p(1-p)^{k-1} = 1-(1-p)^n, \text{for } n = 1, 2, \dots +$$ + +**Exponential CDF** + +$$ +F_{\text{exp}}(x) = P(X\le x) = 0, \text{ for } x\le0,\\ +F_{\text{exp}}(x) = \int_{0}^x \lambda e^{-\lambda t}\mathrm dt = 1 - e^{-\lambda x}, \text{for }x\ge 0. +$$ + +Exponential Distribution is Memoriless, like Geometric: + +$$ +P(X \ge c + x| X \ge c) = e^{-\lambda x} = P(X \ge x)\\ +$$ + +The relationship: + +![](../images/prob/L6_1.jpg) + +### Normal Random Variables + +$$ +f_X(x) = \frac{1}{\sqrt{2\pi}\sigma}e^{-(x-\mu)^2/2\sigma^2}\\ +E[X] =\mu\\ +\text{var}(X) = \sigma^2 +$$ + +Gaussian is good, since adding two Gaussian functions resulting in a new Gaussian functions. And with a huge mount of samples, the distribution is close to Gaussian(Central limit theorem). + +**The Standard Normal Random Variable** + +Normal(Gaussian) + +$$ +Y = \frac{X - \mu}{\sigma}\\ +f_Y(y) = \frac{1}{\sqrt{2\pi}}e^{-y^2/2}\\ +E[Y] = 0\\ +\text{var}(Y) = 1\\ +$$ + +The CDF of Normal Random Variable $\Phi(y)$ can not be derived directly, we can use the standard normal table to get the value. + +$$ +\Phi(-y) = 1 - \Phi(y) +$$ + +### Multiple Continuous Random Variables + +**Joint PDFs** + +The two continuous RVs X and Y, with the same experiment, are jointly continuous if they can be described by a joint PDF $f_{X, Y}$, where $f_{X, Y}$ is a nonnegative function that satisfies + +$$ +P((X, Y) \in B) = \iint_{(x, y)\in B} f(X, Y)\mathrm d x\mathrm dy +$$ + +for every subset B of the two-dimensional plane. In particular, when B is the form $B = \{(x, y)|a\le x \le b, c\le y \le d\}$, we have + +$$ +P(a\le X \le b, c \le Y \le d) = \int_c^d\int_a^bf_{X, Y}(x, y)\mathrm dx\mathrm dy +$$ + +**Normalization** + +$$ +\int_{-\infty}^\infty\int_{-\infty}^\infty f_{X, Y}(x, y)\mathrm dx\mathrm dy = 1 +$$ + +**Interpretation(Small rectangle)** + +$$ +P(a\le X \le a + \delta, c \le Y \le c + \delta) \approx f_{X, Y}(a, c)\cdot\delta^2 +$$ + +**Marginal PDF** + +$$ +P(X\in A) = P(X \in A, Y \in (-\infty, \infty)) = \int_A \int_{-\infty}^\infty f_{X, Y}(x, y)\mathrm dy\mathrm dx +$$ + +$$ +f_X(x) = \int_{-\infty}^\infty f_{X, Y}(x, y)\mathrm dy\\ +f_Y(y) = \int_{-\infty}^\infty f_{X, Y}(x, y)\mathrm dx +$$ + +**Joint CDF** + +If X and Y are two RVs asscociated with the same experiment, then the joint CDF of X and Y is the function + +$$ +F_{X, Y}(x, y) = P(X\le x, Y\le y) = P(X\le x|Y\le y)P(Y\le y) = \int_{-\infty}^y\int_{-\infty}^x f_{X, Y}(u, v)\mathrm du\mathrm dv +$$ + +Conversely + +$$ +f_{X, Y}(x, y) = \frac{\partial^2F_{X, Y}}{\partial x\partial y}(x, y) +$$ + +**Expectations** + +$$ +E[g(X, Y)] = \int_{-\infty}^\infty\int_{-\infty}^\infty g(x, y)f_{X, Y}(x, y)\mathrm dx\mathrm dy +$$ + +If g is linear, of the form of $g(x, y) = ax + by + c$, then + +$$ +E[g(X, Y)] = aE[X] + bE[Y] + c +$$ + +X and Y are called independent if + +$$ +f_{X, Y}(x, y) = f_X(x)f_Y(y) +$$ + +### Conditional and Independence + +**Conditional PDFs** + +Let X and Y be continuous RVs with joint PDF $f_{X, Y}$. For any $f_Y(y) \gt 0$, the conditional PDF of X given Y = y is defined by + +$$ +f_{X|Y}(x|y) = \frac{f_{X, Y}(x, y)}{f_Y(y)} +$$ + +Discrete case: + +$$ +p_{X|Y}(x|y) = \frac{p_{X, Y}(x, y)}{p_Y(y)} +$$ + +By analogy, for fixed y would like: + +$$ +P(x \le X \le x + \delta|Y = y) \approx f_{X|Y}(x|y)\cdot\delta +$$ + +But {Y = y} is a zero-probability event. + +Let $B = \{y\le Y \le y + \epsilon\}$, for small $\epsilon > 0$. Then + +$$ +P(x \le X \le x + \delta|Y \in B) \approx \frac{P(x \le X \le x + \delta)}{P(y \le Y \le y + \epsilon)} \approx \frac{f_{X, Y}(x, y)\cdot\epsilon\delta}{f_Y(y)\cdot\epsilon} \approx f_{X|Y}(x|y)\cdot\delta +$$ + +Limiting case when $\epsilon \rightarrow 0$, to define conditional PDF where the denominator is a zero-probability event. + +**Conditional Expectation** + +The conditional expectation of X given that A has happened is defined by + +$$ +E[X|A] = \int_{-\infty}^\infty xf_{X|A}(x)\mathrm dx +$$ + +For a function g, we have + +$$ +E[g(X)|A] = \int_{-\infty}^\infty g(x)f_{X|A}(x)\mathrm dx +$$ + +**Total expectation theorem** + +Le $A_1, A_2, \dots A_n$ be disjoint events that form a partition of the sample space $\Omega$. And $P(A_i)\gt 0$ for all $i$. Then + +$$ +E[g(X)] = \sum_{i=1}^n P(A_i)E[g(X)|A_i] +$$ + +Conditional Expectation + + +The conditional expectation of X given that $Y = y$ has happened is defined by + +$$ +E[X|Y=y] = \int_{-\infty}^\infty xf_{X|Y}(x|y)\mathrm dx +$$ + +For a function g, we have + +$$ +E[g(X)|Y=y] = \int_{-\infty}^\infty g(x)f_{X|Y}(x|y)\mathrm dx +$$ + +Total expectation theorem + +$$ +E[X] = E_{Y}\left[E_{X|Y}[X|Y]\right] = \int_{-\infty}^\infty E[X|Y = y]f_Y(y)\mathrm dy +$$ + +**Independence** + +Two continuous RVs $X$ and $Y$ are independent if and only if + +$$ +f_{X, Y}(x, y) = f_X(x)f_Y(y) +$$ + +Independence is the same as the condition + +$$ +f_{X|Y}(x|y) = f_X(x) +$$ + +If $X$ and $Y$ are independent, then + +$$ +E[XY] = E[X]E[Y]\\ +E[g(x)h(y)] = E[g(x)]E[h(y)], \forall g, h\\ +\text{var}(X + Y) = \text{var}(X) + \text{var}(Y)\\ +$$ + +### The continuous Bayes's rule + + +$$ +f_{Y|X}(y|x) = \frac{f_Y(y)f_{X|Y}(x|y)}{f_Y(y)} +$$ + +Based on the normalization property $\int_{-\infty}^\infty f_{X|Y}(x|y)\mathrm dx = 1$, + +$$ +f_{Y|X}(y|x) = \frac{f_Y(y)f_{X|Y}(x|y)}{\int_{-\infty}^\infty f_X(t)f_{Y|X}(y|t)\mathrm dt} +$$ + +## Derived distributions and Entropy + +### Derived Distribution + +If we want to calculate the expectation $E[g(X)]$, there's no need to calculate the PDF $f_X$ of $X$. + +But sometimes we want the PDF $f_Y$ of $Y = g(X)$, where $Y$ is a new RV. + +**Principal Method** + +Two-step procedure for the calculation of the PDF of a function $Y=g(X)$ of a continuous RV $X$ + +1. Calcualte the CDF $F_Y$ of $Y$: $F_Y(y) = P(Y \le y)$ +2. Differentiate $F_Y$ to obtain the PDF $f_Y$ of $Y$: $f_Y(y) = \frac{\mathrm d F_Y}{\mathrm d y}(y)$ + +**The PDF of $Y=aX + b$** + +Suppose $a>0$ and $b$ are constants. + +$$ +f_Y(y) = \frac{\mathrm d F_Y}{\mathrm d y}(y) = \frac{\mathrm d}{\mathrm d y} F_X(\frac{y-b}{a}) = \frac{1}{a}f_X(\frac{y-b}{a}) +$$ + +If $X$ is Normal, then $Y = aX + b$ is also Normal. + +Suppose X is normal with mean $\mu$ and variance $\sigma^2$. Then + +$$ +f_Y(y) = \frac{1}{a\sqrt{2\pi\sigma^2}}\exp\left(-\frac{(y-b-a\mu)^2}{2a^2\sigma^2}\right) +$$ + +$$ +Y = aX + b \sim N(a\mu + b, a^2\sigma^2) +$$ + +**The PDF of a strictly monotonic function** + +Suppose $g$ is a strictly monotonic function and that for some function $h$ and all $x$ in the range of $X$ we have + +$$ +y = g(x) \text{ if and only if } x = h(y) +$$ + +Assume that $h$ is differentiable. + +Then the PDF of $Y = g(X)$ is given by + +$$ +f_Y(y) = \frac{\mathrm d F_Y}{\mathrm d y}(y) = \frac{\mathrm d}{\mathrm d y} F_X(h(y)) = f_X(h(y))\left|\frac{\mathrm d h}{\mathrm d y}(y)\right| +$$ + +### Entropy +**Defintion** + +Discrete case + +Let $X$ be a discrete RV defined on probability space $(\Omega, \mathcal F, P)$. The **entropy** of $X$ is defined by + +$$ +H(X) = -E[\ln p_X(X)] = -\sum_{k} p_X(x_k)\ln p_X(x_k) +$$ + +Continuous case + +Let $X$ be a continuous RV defined on probability space $(\Omega, \mathcal F, P)$. The **differential entropy** of $X$ is defined by + +$$ +H(X) = -E[\ln f_X(X)] = -\int_{-\infty}^\infty f_X(x)\ln f_X(x)\mathrm dx +$$ + + +**Remarks** + +* a special expectation of a random variable +* a measure of uncertainty in a random experiment +* - the larger the entropy, the more uncertain the experiment +* - For a deterministic event, the entropy is zero +* The base of logarithm can be different. Changing the base od the logarithm is equivalent to multiplying the entropy by a constant. +* - With base 2, we say that the entropy is in units of **bits** +* - With base e, we say that the entropy is in units of **nats** +* The basis of information theory + +### Maximum entropy distributions + +• Maximum entropy distributions + +− Distributions with maximum entropy under some constraints + +− Gaussian, exponential, and uniform distributions are all maximum entropy distributions under certain conditions + +• Why studying maximum entropy distributions? + +− The most random distribution, reflecting the maximum uncertainty about the quantity of interest + +**Definition** + +**Discrete Case** + +X can be a finite number of values $x_1, x_2, \dots, x_n$, satisfying $p_X(x_k) = p_k.$ + +We have the following optimization problem: + +$$ +\max_{X} H(X) = \max_{p_1, p_2, \dots, p_n} \left(-\sum_{k=1}^n p_k\ln p_k\right)\\ +\text{s.t.} \sum_{k=1}^n p_k = 1, p_k \ge 0 \text{ for } k = 1, 2, \dots, n +$$ + +**Solution** + +Applying the Lagrange multiplier method, we have + +$$ +L(p_1, p_2, \dots, p_n;\lambda) = -\sum_{k=1}^n p_k\ln p_k + \lambda\left(\sum_{k=1}^n p_k - 1\right)\\ +\frac{\partial L}{\partial p_k} = -\ln p_k - 1 + \lambda = 0\\ +\Rightarrow p_k = e^{\lambda - 1}\\ +$$ + +Note that the above is true for all $k$. So we have + +$$ +p_k = e^{\lambda - 1} = \frac1{n}\text{ for } k = 1, 2, \dots, n. +$$ + +**Continuous Case 1** + +$X \in [-\infty, \infty]$. + +Constrain on mean and variance, +we have the following optimization problem: + +$$ +\max_{X}h(X), \\ +\text{s.t. }E[X] = \mu, \quad Var(X) = \sigma^2 +$$ + +In detail, + +$$ +\max_{X} H(X) = \max_{\mu, \sigma^2} \left(-\int_{-\infty}^\infty f_X(x)\ln f_X(x)\mathrm dx\right)\\ +\text{s.t. }\int_{-\infty}^\infty f(x)\mathrm dx = 1, \quad \int_{-\infty}^\infty xf(x)\mathrm dx = \mu, \quad \int_{-\infty}^\infty x^2f(x)\mathrm dx = \sigma^2 + \mu^2 +$$ + +Solving the above problem, we have Gaussian distribution with mean $\mu$ and variance $\sigma^2$. + +$$ +f(x) = \frac{1}{\sqrt{2\pi\sigma^2}}\exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right) +$$ + +**Solution** + +For all measurable functions $g$, we have + +$$ +G(t) = h(f + tg) = -\int_{\infty}^\infty (f(x) + tg(x))\ln (f(x) + tg(x))\mathrm dx +$$ + +Therefore, + +$$ +h(f_{opt})\ge h(f_{opt} + tg)\\ +\Rightarrow G(0)\ge G(t), \forall t \in \R +$$ + +$G(t)$ reaches its maximum at $t = 0$. + +Then apply the Lagrange multiplier method, we have + +$$ +\overline{G}(t) = G(t) + c_0h_0(t) + c_1h_1(t) + c_2h_2(t)\\ +$$ + +Get the derivative of $\overline{G}(t)$ with regard to $t$, and let the derivative equal to zero. + +**Continuous Case 2** + +$X \in [0, \infty)$. + +Constrain on mean only, we have the following optimization problem: + +$$ +\max_{X}h(X), \\ +\text{s.t. }E[X] = \mu +$$ + +In detail, + +$$ +\max_{X} H(X) = \max_{\mu} \left(-\int_{0}^\infty f_X(x)\ln f_X(x)\mathrm dx\right)\\ +\text{s.t. }\int_{0}^\infty f(x)\mathrm dx = 1, \quad \int_{0}^\infty xf(x)\mathrm dx = \mu +$$ + +Solving the above problem, we have exponential distribution with parameter $\lambda$. + +$$ +f(x) = \lambda e^{-\lambda x}, x \in [0, \infty) +$$ + +**Continuous Case 3** + +$X \in [a, b]$. + +No constrain, we have the unconstrained optimization problem: + +$$ +\max_{X}h(X) +$$ + +In detail, + +$$ +\max_{X} H(X) = \max_{a, b} \left(-\int_{a}^b f_X(x)\ln f_X(x)\mathrm dx\right)\\ +\text{s.t. }\int_{a}^b f(x)\mathrm dx = 1 +$$ + +Solving the above problem, we have uniform distribution within $[a, b]$. + +$$ +f(x) = \frac{1}{b-a}, x \in [a, b] +$$ + +## Convolution, covariance, correlation, and conditional expectation + +### Convolution + +**Discrete case** + +$$ +\begin{align*} +p_W(w) &= P(X+Y=w)\\ +&= \sum_{x}P(X=x, Y=w-x)\\ +&= \sum_{x}P(X=x)P(Y=w-x)\\ +&= \sum_{x}p_X(x)p_Y(w-x)\\ +\end{align*} +$$ + +PMF $p_W$ is the convolution of PMFs $p_X$ and $p_Y$. + +**The distribution of $X+Y$** + +Mechanics: +- Put the PMF's on top of each other +- Flip the PMF of $Y$ +- Shift the flipped PMF by $w$ (to the right if $w>0$) +- Cross-multiply and add + +**Continuous Case** + +$$ +\begin{align*} +&W = X+Y, X, Y \text{ are independent}\\ +&P(W\le w|X=x) = P(Y\le w-x)\\ +&f_{W|X}(w|x) = f_Y(w-x)\\ +&f_{W, X}(w, x) = f_X(x)f_Y(w-x)\\ +&f_W(w) = \int_{-\infty}^\infty f_X(x)f_Y(w-x)\mathrm dx\\ +\end{align*} +$$ + +**Sum of 2 independent normal RVs** + +$$ +\begin{align*} + & X\sim N(\mu_1, \sigma_1^2), Y\sim N(\mu_2, \sigma_2^2)\\ + &f_{X,Y}(x, y) = \frac{1}{2\pi \sigma_x\sigma_y}\text{exp}\left\lbrace-\frac{(x-\mu_x)^2}{2\sigma_x^2} - \frac{(y-\mu_y)^2}{2\sigma_y^2}\right\rbrace +\end{align*} +$$ + +which is constant on the ellipse(circle if $\sigma_x = \sigma_y$). + +$$ +\begin{align*} + X\sim N(0, \sigma_x), &Y\sim N(0, \sigma_y)\\ + W &= X+Y\\ + f_W(w) &= \int_{-\infty}^\infty f_{X,Y}(x, w-x)\mathrm dx\\ + &= \int_{-\infty}^\infty \frac{1}{2\pi \sigma_x\sigma_y}\text{exp}\left\lbrace-\frac{x^2}{2\sigma_x^2} - \frac{(w-x)^2}{2\sigma_y^2}\right\rbrace\mathrm dx\\ + =ce^{-\gamma \omega^2} +\end{align*} +$$ + +$W$ is Normal. + +Mean = 0, Variance = $\sigma_x^2 + \sigma_y^2$ + +Same argument for nonzero mean case. + +**The difference of two independent RVs** + +$X$ and $Y$ are independent exponential RVs with parameter $\lambda$. + +Fix some $z\ge 0$ and note that $f_Y(x-z)$ is non zero when $x\ge z$. + +$$ +\begin{align*} + Z &= X - Y\\ + f_Z(z) &= \int_{-\infty}^\infty f_X(x)f_{-Y}(z - x)\mathrm dx\\ + &= \int_{-\infty}^\infty f_X(x)f_{Y}(x - z)\mathrm dx\\ + &= \int_{z}^\infty \lambda e^{-\lambda x}\lambda e^{-\lambda(x-z)}\mathrm dx\\ + &= \frac{\lambda}{2}e^{-\lambda z} +\end{align*} +$$ + +The answer for the case $z\le 0$ + +$$ +f_{X-Y}(z) = f_{Y-X}(z) = f_Z(-z) +$$ + +The first quality holds by symmetry. + +### Covariance and Correlation + +**Definition** + +The covariance of two RVs $X$ and $Y$, denoted by $\text{cov}(X, Y)$, is defined by + +$$ +\text{cov}(X, Y) = E\left[(X - E[X])(Y - E[Y])\right] +$$ + +or, + +$$ +\text{cov}(X, Y) = E[XY] - E[X]E[Y] +$$ + +$X$ and $Y$ are **uncorrelated** if $\text{cov}(X, Y) = 0$. + +**Zero mean case** $\text{cov}(X, Y) = E[XY]$ + +**Properties** + +$$ +\text{cov}(X, Y) = \text{var}(X, Y)\\ +\text{cov}(X, aY+b) = a\cdot\text{cov}(X, Y)\\ +\text{cov}(X, Y+Z) = \text{cov}(X, Y) + \text{cov}(X, Z)\\ +\text{independent} \Rightarrow \text{cov}(X, Y) = 0(\text{converse is not true}) +$$ + +**Variance of the sum of RVs** + +$$ +\text{var}\left(\sum_{i = 1}^nX_i\right) = \sum_{i = 1}^n\text{var}(X_i) + \sum_{\lbrace(i, j)|i\ne j\rbrace}\text{cov}(X_i, X_j) +$$ + +In particular, + +$$ +\text{var}(X_1 + X_2) = \text{var}(X_1) + \text{var}(X_2) + 2\text{cov}(X_1, X_2) +$$ + +**Correlation coefficient** + +The correlation coefficient $\rho(X, Y)$ of two RVs $X$ and $Y$ that have nonzero variance is defined as + +$$ +\begin{align*} +\rho &= E\left[\frac{(X - E[X])}{\sigma_X} \cdot \frac{(Y - E[Y])}{\sigma_Y}\right]\\ +&= \frac{\text{cov}(X, Y)}{\sigma_X\sigma_Y} +\end{align*} +$$ + +* $-1 \le \rho \le 1$ +* $|\rho| = 1 \Leftrightarrow (X-E[X]) = c(Y-E[Y])$ +* Independent $\Rightarrow \rho = 0(\text{converse is not true})$ + +**Conditional expected value** + +$$ +E[X|Y = y] = \sum_x xp_{X|Y}(x|y) +$$ + +### Conditional expectation + +**Definition** + +$$ +E[X|Y = y] = \begin{cases} + \sum_x xp_{X|Y}(x|y), & X \text{discrete},\\ + \int_{-\infty}^\infty xf_{X|Y}(x|y)\mathrm dx, & X \text{continuous}. +\end{cases} +$$ + +$E[X|Y=y]$ is a function of $y$. + +$$ +E[X|Y = y] = \frac{y}{2}(\text{number})\\ +E[X|Y] = \frac{Y}{2}(\text{RV}) +$$ + +**Law of iterated expectations** + +$$ +E[X] = E[E[X|Y]] = \begin{cases} + \sum_y E[X | Y = y]p_Y(y), & Y \text{discrete},\\ + \int_{-\infty}^\infty E[X|Y = y]f_Y(y)\mathrm dy, & Y \text{continuous}. +\end{cases} +$$ + +### Conditional expectation as an estimator + +Denote the conditional expectation + +$$ +\hat{X} = E[X|Y] +$$ + +as an estimator of $X$ given $Y$, and the estimation error + +$$ +\tilde{X} = X - \hat{X} +$$ + +is a RV. + +**Properties of the estimator**: + +**Unbiased** + +For **any** possible $Y=y$: + +$$ +E[\tilde{X}|Y] = E[X - \hat{X} | Y] = E[X | Y] - E[\hat{X}|Y] = \hat{X} - \hat{X} = 0 +$$ + +By the law of iterated expectations + +$$ +E[\tilde{X}] = E[E[\tilde{X}|Y]] = 0 +$$ + +**Uncorrelated** + +$$ +E[\hat{X}\tilde{X}] = E[E[\hat{X}\tilde{X}|Y]] = E[\hat{X}E[\tilde{X}|Y]] = 0 +$$ + +$$ +\text{cov}(\hat{X}, \tilde{X}) = E[\hat{X}\tilde{X}] - E[\hat{X}]E[\tilde{X}] = 0 +$$ + +Since $X = \hat{X} + \tilde{X}$, the variance of X can be decomposed as + +$$ +\text{var}(X) = \text{var}(\hat{X}) + \text{var}(\tilde{X}) +$$ + +$$ +\text{var}(\tilde{X}) = \text{var}(E[X|Y]) +$$ + +Conditional variance + +$$ +\text{var}(X|Y) = E[(X - E[X|Y])^2|Y] = E[\tilde{X}^2|Y] +$$ + +here comes the law of total variance: + +$$ +\text{var}(X) = \text{var}(E[X|Y]) + E[\text{var}(X|Y)] +$$ + +The total variability is avarage variability within sections + variability between sections. + +**Law of iterated expectations** + +$$ +E[X] = E[E[X|Y]] = \sum_y E[X|Y = y]p_Y(y) +$$ + + +**Conditional variance** + +$$ +\text{var}(X|Y) = E[(X - E[X|Y])^2|Y] = E[\tilde{X}^2|Y] +$$ + +**Law of total variance** + +$$ +\text{var}(X) = \text{var}(E[X|Y]) + E[\text{var}(X|Y)] +$$ + + +## Transforms and sum of a random number of random variables + +The transform associated with a RV $X$ is a function $M_X(s)$ of a scalar parameter $s$, defined by + +$$ +M_X(s) = E[e^{sX}] = \begin{cases} + \sum_x e^{sx}p_X(x), & X \text{discrete},\\ + \int_{-\infty}^\infty e^{sx}f_X(x)\mathrm dx, & X \text{continuous}. +\end{cases} +$$ + +**Remarks** +- a function of $s$, rather than a number +- not necessarily defined for all (complex) s +- always well defined for $\Re(s)=0$ +- compared with Laplace transform +### Properties +**Sanity Checks** + +$$ +M_X(0) = 1\\ +|M_X(s)| \le 1 \text{ for } \Re(s) = 0 +$$ + +**Linear operation** +$$ +M_{aX + b}(s) = e^{bs}M_X(as)\\ +M_{X + Y}(s) = M_X(s)M_Y(s) (\text{if X, Y independent}) +$$ + +**Expected Values** + +$$ +E[X^n] = \frac{\partial^n M_X(s)}{\partial s^n}\bigg|_{s=0} +$$ + +$$ +P(X = c) = \lim_{N\rightarrow \infty}\frac 1N\sum_{k = 1}^N M_X(jk)e^{-jkc} +$$ + +since + +$$ +\lim_{N\rightarrow \infty}\frac 1N\sum_{k = 1}^N M_X(jk)e^{-jkc} = \sum_{x = 1}^\infty p_X(x)\lim_{N\rightarrow \infty}\frac 1N\sum_{k = 1}^N e^{-jc(k - x)} = \sum_{x = 1}^\infty p_X(x)\lim_{N\rightarrow \infty}\frac{1}{N} \frac{e^{j(x-c)} - e^{Nj(x - c)}}{1-e^{j(x-c)}} = p_X(c) +$$ + +**Example** + +$X$ is a Poisson RV with parameter $\lambda$ + +$$ +p_X(x) = \frac{\lambda^x}{x!}e^{-\lambda} +$$ + +$$ +M(s) = \sum_{x = 0}^\infty e^{sx}\frac{\lambda^x}{x!}e^{-\lambda} = e^{-\lambda}\sum_{x = 0}^\infty \frac{(e^s\lambda)^x}{x!} = e^{-\lambda}e^{e^s\lambda} = e^{\lambda(e^s - 1)} +$$ + +$X$ is an exponential RV with parameter $\lambda$ + +$$ +f_X(x) = \lambda e^{-\lambda x} +$$ + +$$ +M(s) = \int_0^\infty e^{sx}\lambda e^{-\lambda x}\mathrm dx = \frac{\lambda}{\lambda - s} +$$ + +$Y$ is a standard normal RV, + +$$ +M_Y(s) = \int_{-\infty}^\infty \frac{1}{\sqrt{2\pi}}e^{-(y^2/2)}e^{sy}\mathrm dy = e^{s^2/2} +$$ + +Consider $X = \sigma Y + \mu$ + +$$ +M_X(s) = e^{s^2\sigma^2/2 + \mu s} +$$ + +### Inversion of transforms + +**Inversion Property** + +The transform $M_X(s)$ associated with a RV $X$ uniquely determines the CDF of $X$, assuming that $M_X(s)$ is finite for all $s$ in some interval $[-a, a]$, where $a$ is a positive number. + +Example: + +$$ +\begin{align*} +M(s) &= \frac{pe^s}{1 - (1 - p)e^s}\\ +&= pe^s(1 + (1-p)e^s + (1-p)^2e^{2s} + \dotsb)\\ +&= \sum_{k = 1}^\infty p(1-p)^{k - 1}e^{ks} +\end{align*} +$$ + +The probability $P(X = k)$ is found by reading the coefficient of the term $e^{ks}$: + +$$ +P(X = k) = p(1-p)^{k-1} +$$ + +### Transform of Mixture of Distributions + +Let $X_1,\dotsb, X_n$ be continuous RVs with PDFs $f_{X_1}, \dotsb, f_{X_n}$. + +The value $y$ of RV $Y$ is generated as follows: an index $i$ is chosen with a corresponding probability $p_i$, and $y$ is taken to be equal to the value $X_i$. Then, + +$$ +f_Y(y) = p_1f_{X_1}(y) + \dotsb + p_nf_{X_n}(y)\\ +M_Y(s) = p_1M_{X_1}(s) + \dotsb + p_nM_{X_n}(s) +$$ + +### Sum of independend RVs + +Let $X$ and $Y$ be independent RVs, and let $Z = X + Y$. The transform associated with $Z$ is + +$$ +M_Z(s) = M_X(s)M_Y(s) +$$ + +Since + +$$ +M_Z(s) = E[e^{sZ}] = E[e^{s(X + Y)}] = E[e^{sX}e^{sY}] = E[e^{sX}]E[e^{sY}] = M_X(s)M_Y(s) +$$ + +Generalization: + +A collection of independent RVs: $X_1, \dotsb, X_n$, $Z = X_1 + \dotsb + X_n$ , + +$$ +M_Z(s) = M_{X_1}(s)\dotsb M_{X_n}(s) +$$ + +**Example** + +Let $X_1, \dotsb, X_n$ be independent Bernoulli RVs with a common parameter $p$: + +$$ +M_{X_i}(s) = 1 - p + pe^s +$$ + +$Z = X_1 + \dotsb + X_n$ is binomial with parameters n and p: + +$$ +M_z(s) = (1 - p + pe^s)^n +$$ + +Let $X$ and $Y$ be independent Poisson RVs with means $\lambda$ and $\mu$, and let $Z = X + Y$. Then $Z$ is still Poisson with mean $\lambda + \mu$. + +$$ +M_Z(s) = M_X(s)M_Y(s) = e^{(\lambda +\mu)(e^s - 1)} +$$ + +Let $X$ and $Y$ be independent Gaussian RVs with means $\mu_x$ and $\mu_y$, and variances $\sigma_x^2, \sigma_y^2$. And let $Z = X + Y$. Then $Z$ is still Gaussian with mean $\mu_x + \mu_y$ and variance $\sigma_x^2 + \sigma_y^2$ + +$$ +M_X(s) = \exp\bigg\lbrace\frac{\sigma_x^2s^2}{2} + \mu_x s\bigg\rbrace\\ +M_Y(s) = \exp\bigg\lbrace\frac{\sigma_y^2s^2}{2} + \mu_y s\bigg\rbrace\\ +M_Z(s) = M_X(s)M_Y(s) = \exp\bigg\lbrace\frac{(\sigma_x^2 + \sigma_y^2)s^2}{2} + (\mu_x + \mu_y)s\bigg\rbrace +$$ + +Consider + +$$ +Y = X_1 + \dotsb + X_N +$$ + +where $N$ is a RV that takes integer values, and $X_1, \dotsb, X_N$ are identically distributed RVs. + +Assume that $N, X_1, \dotsb$ are independent. + +$$ +E[Y|N = n] = E[X_1 + X_2 + \dotsb + X_n|N = n] = nE[X]\\ +E[Y|N] = NE[X]\\ +E[Y] = E[E[Y|N]] = E[NE[X]] = E[N]E[X] +$$ + +For the variance, + +$$ +E[Y|N] = NE[X]\\ +\text{var}(E[Y|N]) = (E[X])^2\text{var}(N)\\ +\text{var}(Y|N=n) = n\text{var}(X)\\ +\text{var}(Y|N) = N \text{var}(X)\\ +E[\text{var}(Y|N)] = E[N]\text{var}(X)\\ +$$ + +So, + +$$ +\text{var}(Y) = E[\text{var}(Y|N)] + \text{var}(E[Y|N]) = E[N]\text{var}(X) + (E[X])^2\text{var}(N) +$$ + +For transform, + +$$ +E[e^{sY}|N = n] = E[e^{sX_1}\dotsb e^{sX_n}|N = n] = E[e^{sX}]^n = (M_X(s))^n\\ +M_Y(s) = E[e^{sY}] = E[E[e^{sY}|N]] = E[(M_X(s))^N] = \sum_{n = 0}^\infty (M_X(s))^n p_N(n) = \sum_{n = 0}^\infty e^{n\log M_X(s)}p_N(n) = M_N(\log M_X(s)) +$$ + +**Summary on Properties** + +Consider the sum + +$$ +Y = X_1 + \dotsb + X_N +$$ + +where $N$ is a RV that takes integer values, and $X_1, X_2, \dotsb$ are identically distributed RVs. Assume that $N$, $X_1, X_2, \dotsb$ are independent. + +$$ +E[Y] = E[N]E[X]\\ +\text{var}(Y) = E[N]\text{var}(X) + (E[X])^2\text{var}(N)\\ +M_Y(s) = M_N(\log M_X(s)) +$$ + +**Example** + +Assume that $N$ and $X_i$ are both geometrically distributed with parameters $p$ and $q$ respectively. All of these RVs are independent. $Y = X_1 + \dotsb + X_N$ + +$$ +M_N(s) = \frac{pe^s}{1 - (1-p)e^s}\\ +M_X(s) = \frac{qe^s}{1 - (1-q)e^s}\\ +M_Y(s) = M_N(\log M_X(s)) = \frac{pqe^s}{1 - (1-pq)e^s} +$$ + +$Y$ is also geometrically distributed, with parameter $pq$. + +## Weak law of large numbers + +### Markov inequality + +If a RV $X$ can only take nonnegative values, then + +$$ +P(X \ge a) \le \frac{E[X]}{a}, \text{ for all } a \gt 0. +$$ + +Intuition: If a nonnegative RV has a small mean, then the probability that it takes a large value must be small。 + +Fix a positive number $a$, + +$$ +E[X] = \int_0^\infty xf_X(x)dx = \int_0^a xf_X(x)dx + \int_a^\infty xf_X(x)dx \ge 0 + \int_a^\infty xf(x)dx \ge \int_a^\infty af_X(x)dx = aP(X \ge a) +$$ + +### Chebyshev's Inequality + +If $X$ is a RV with mean $\mu$ and variance $\sigma^2$, then + +$$ +P(|X - \mu| \ge c) \le \frac{\sigma^2}{c^2} +$$ + +Intuition: If a RV has small variance, then the probability that it takes a value far from its mean is also small. + +$$ +\begin{align*} +\sigma^2 &= \int (x - \mu)^2f_X(x)\mathrm dx\\ +&\ge \int_{-\infty}^{\mu - c} (x - \mu)^2f_X(x)\mathrm dx + \int_{ \mu + c}^\infty (x - \mu)^2f_X(x)\mathrm dx\\ +&\ge \int_{-\infty}^{\mu - c} c^2f_X(x)\mathrm dx + \int_{ \mu + c}^\infty c^2f_X(x)\mathrm dx\\ +&= \int_{|x - \mu| \ge c} c^2f_X(x)\mathrm dx\\ +&=c^2P(|X - \mu| \ge c) +\end{align*} +$$ + +The upperbounds of $\sigma^2$: + +$$ +X \in [a, b]\\ +\sigma^2 \le (b - a)^2/4 +$$ + +**Chernoff inequality** + +If a RV $X$ has MGF $M_X(s)$, then + +$$ +P(X \ge a) \le e^{-\max_{s\ge 0}\left(sa - \ln M_X(s)\right)} +$$ + +or, for $s \ge 0$ + +$$ +P(X\ge a) \le e^{-sa}M_X(s) +$$ + +for $s \lt 0$ + +$$ +P(X \le a) \le e^{-sa}M_X(s) +$$ + +proof: for $s \ge 0$ + +$$ +M_X(s) = \int_{-\infty}^a e^{sx}f_X(x)\mathrm dx + \int_a^{\infty} e^{sx}f_X(x)\mathrm dx\\ +\ge 0 + e^{sa}\int_a^{\infty} f_X(x)\mathrm dx = e^{sa}P(X \ge a) +$$ + +### Weak law of large numbers + +Let $X_1, X_2, \dots$ be independent identically distributed (i.i.d.) RVs with finite mean $\mu$ and variance $\sigma^2$ + +$$ +M_n = \frac{X_1 + X_2 + \dotsb + X_n}{n}\\ +E[M_n] = \mu\\ +\text{var}(M_n) = \frac{\sigma^2}{n} +$$ + +Applying the Chebyshev inequality and we get: + +$$ +P(|M_n - \mu| \ge \epsilon) \le \frac{\text{var}(M_n)}{\epsilon^2} = \frac{\sigma^2}{n\epsilon^2} +$$ + +For large $n$, the bulk of the distribution of $M_n$ is concentrated near $\mu$ + +**Theorem** + +Let $X_1, X_2, \dots$ be independent identically distributed (i.i.d.) RVs with finite mean $\mu$ and variance $\sigma^2$. For every $\epsilon \gt 0$, we have + +$$ +P(|M_n - \mu| \ge \epsilon) = P\left(\left|\frac{X_1 + \dotsb + X_n}{n} - \mu\right|\ge \epsilon\right) \rightarrow 0, \text{ as } n \rightarrow \infty +$$ + +$M_n$ converges **in probability** to $\mu$. + +### Convergence "in Probability" + +Theorem: Convergence in Probability + +Let $\lbrace Y_n\rbrace$(or $Y_1, Y_2, \dots$) be a sequence of RVs(not necessarily independent), and let $a$ be a real number. We say that the sequence $Y_n$ **converges to** $a$ in probability, if for every $\epsilon \gt 0$, we have + +$$ +\lim_{n \rightarrow \infty} P(|Y_n - a| \ge \epsilon) = 0 +$$ + +(almost all) of the PMF/PDF of $Y_n$, eventually gets concentrated (arbitrarily) close to $a$. + +### Many types of convergence + +Deterministic limits: $\lim_{n\rightarrow \infty} a_n = a$ + +$$ +|a_n - a|\le \epsilon, \forall n \ge N, \epsilon \gt 0 +$$ + +Convergence in probability: $X_n\stackrel P{\rightarrow} X$ + +$$ +\lim_{n \rightarrow \infty}P(|X_n - X|\ge \epsilon) = 0, \forall \epsilon \gt 0 +$$ + +(WLLN) + +Convergence in Distribution: $X_n \stackrel{D}{\rightarrow} X$ + +$$ +\lim_{n \rightarrow \infty} P(X_n \le x) = P(X \le x), \forall x +$$ + +For all points of $x$ at which the function $F_X(x) = P(X\le x)$is continuous. + +(CLT) + +Convergence with probability $1$(almost surely): $X_n \stackrel{\text{a.s.}}{\rightarrow} X$ + +$$ +P\left(\lbrace\omega\in \Omega: \lim_{n\rightarrow\infty}X_n(\omega) =X(\omega)\rbrace\right) = 1 +$$ + +or + +$$ +P\left(\lim_{n\rightarrow\infty}X_n(\omega) =X(\omega)\right) = 1 +$$ + +Lemma: + +$$ +X_n \stackrel{\text{a.s.}}{\rightarrow} X \Leftrightarrow \lim_{m \rightarrow\infty}P(|X_n - X|\le \epsilon, \forall n \gt m) = 1, \forall \epsilon \gt 0\\ +\Leftrightarrow P(|X_n - X|\gt \epsilon, \text{i.o.}) = 0, \forall \epsilon \gt 0 +$$ + +i.o. stand for infinitely often + +(SLLN) + +Convergence in Mean/in Norm: $X_n \stackrel{r}{\rightarrow}X$ + +if $E[X_n^r] \lt \infty$ for all $n$ and + +$$ +\lim_{n \rightarrow \infty}E[|X_n - X|^r] = 0 +$$ + +Relations: + +$$ +\left(X_n\stackrel {\text{a.s.}}{\rightarrow} X\right) \Rightarrow\left(X_n\stackrel P{\rightarrow} X\right) \Rightarrow \left(X_n\stackrel D{\rightarrow} X\right) \\ +\left(X_n\stackrel {r}{\rightarrow} X\right) \Rightarrow\left(X_n\stackrel P{\rightarrow} X\right) \Rightarrow \left(X_n\stackrel D{\rightarrow} X\right) \\ +\forall r\ge s\ge 1, \left(X_n\stackrel {r}{\rightarrow} X\right) \Rightarrow\left(X_n\stackrel s{\rightarrow} X\right) +$$ + +The converse assertions fail in general! + +The relation between “almost surely” and “in r-th mean” is complicated. There exist sequences which converge almost surely but +not in mean, and which converge in mean but not almost surely! + +## Central Limit Theorem + +### Theorem + +Let $X_1, X_2, \dots$ be i.i.d. RVs with mean $\mu$ and variance $\sigma^2$. Let + +$$ +Z_n = \frac{X_1 + X_2 + \dotsb + X_n - n\mu}{\sigma\sqrt{n}} +$$ + +Then + +$$ +\lim_{n\rightarrow \infty}P(Z_n\le z) = \Phi (z) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^z e^{-\frac{x^2}{2}}\mathrm dx +$$ + +CDF of $Z_n$ converges to normal CDF(converge in distribution) + +### Normal Approximation Based on the Central Limit Theorem + +Let $S_n = X_1 + \dotsb + X_n$, where $X_i$ are $\text{i.i.d.}$ RVs with mean $\mu$ and variance $\sigma^2$. If $n$ is large, the probability $P(S_n ≤ c)$ can be approximated by +treating $S_n$ as if it were normal, according to the following procedure. + +1. Calculate the mean $n\mu$ and the variance $n\sigma^2$ of $S_n$ +2. Calculate the normalinzd value $z = (c - n\mu)/(\sigma\sqrt{n})$ +3. Use the approxmation + +$$ + P(S_n \le c) \approx \Phi(z) +$$ + +where $\Phi(z)$ is available from the standard normal CDF. + +### Proof + +Suppose that $X_1, X_2, \dots$ has mean zero. + +$$ +\begin{align*} +M_{Z_n}(s) &= E[e^{sZ_n}]\\ +&=E\left[\exp\left(\frac{s}{\sigma\sqrt{n}}\sum_{i = 1}^n X_i\right)\right]\\ +&=\prod_{i = 1}^n E[e^{\frac{s}{\sigma\sqrt{n}}X_i}]\\ +&=\prod_{i = 1}^n M_{X_i}\left(\frac{s}{\sigma\sqrt{n}}\right)\\ +&=\left(M_{X}\left(\frac{s}{\sigma\sqrt{n}}\right)\right)^n\\ +\end{align*} +$$ + +Suppose that the transform $M_X(s)$ has a second order Taylor series expansion around $s=0$, + +$$ +M_X(s) = a + bs + cs^2 + o(s^2) +$$ + +where $a = M_X(0) = 1, b = M_X'(0) = E[X] = 0, c = \frac{1}{2}M_X''(0) = \frac{\sigma^2}{2}$ + +Then + +$$ +M_{Z_n}(s) = \left(1 + \frac{s^2}{2n} + o\left(\frac{s^2}{n}\right)\right)^n +$$ + +As $n\rightarrow \infty$, + +$$ +\lim_{n\rightarrow \infty}M_{Z_n}(s) = \lim_{n\rightarrow \infty}\left(1 + \frac{s^2}{2n} + o\left(\frac{s^2}{n}\right)\right)^n = e^{\frac{s^2}{2}} +$$ + +Approxmation on binomial: + +(De Moivre-Laplace Approxmation to the Binomial) + +$$ +P(k \le S_n \le l) = P\left(\frac{k - np}{\sqrt{np(1-p)}} \le \frac{S_n - np}{\sqrt{np(1 - p)}} \le \frac{l - np}{\sqrt{np(1 - p)}}\right)\\ +\approx \Phi\left(\frac{l - np}{\sqrt{np(1 - p)}}\right) - \Phi\left(\frac{k - np}{\sqrt{np(1 - p)}}\right) +$$ + +## The Strong Law of Large Numbers + +### Theorem + +Let $X_1, X_2, \dots$ be i.i.d. RVs with mean $\mu$. + +$$ +P(\lim_{n \rightarrow\infty}\frac{X_1 + \dots + X_n}{n} = \mu) = 1. +$$ + +## Borel-Cantelli lemma & Bernoulli Process + +### Limit of set sequence + +$$ +\limsup_n A_n = \bigcap_{n = 1}^\infty \bigcup_{k = n}^\infty A_k\\ +\liminf_n A_n = \bigcup_{n = 1}^\infty \bigcap_{k = n}^\infty A_k +$$ + +If upper limit equals to lower limit, the limit of set sequence exists. + +$$ +\limsup_n A_n \supseteq \liminf_n A_n\\ +\limsup_n A_n = \liminf_n A_n = \lim_n A_n +$$ + +Upper limit can also be denoted as + +$$ +\limsup_n A_n = \{\omega: \omega \in A_n, \text{i.o.}\} = \lbrace A_n, \text{i.o.}\rbrace +$$ + +### Borel-Cantelli Lemma + +Let $\lbrace A_n, n = 1, 2, \dotsb\rbrace$ be a sequence of events, then + +$$ +\sum_{n = 1}^\infty P(A_n)\lt \infty \xRightarrow{} P(A_n, \text{i.o.}) = 0 +$$ + +Let $\lbrace A_n, n = 1, 2, \dotsb\rbrace$ be a sequence of **independent** events, then + +$$ +\sum_{n = 1}^\infty P(A_n) = \infty \xRightarrow{} P(A_n, \text{i.o.}) = 1 +$$ + +### Stochastic process + +A stochastic process is a mathematical model of a probabilistic experiment that evolves in time and generates a sequence of +numerical values. + +* Bernoulli process(memoryless, discrete time) +* Poisson process(memoryless, continuous time) + +### **The Bernoulli Process** + +is a sequence of independent Bernoulli trials, each with probability of success $p$. + +$$ +P(\text{success}) = P(X_i = 1) = p\\ +P(\text{failure}) = P(X_i = 0) = 1 - p +$$ + +**Independence property**: For any given time $n$, the sequence of $X_{n + 1}, X_{n + 2}, \dots$ is also a Bernoulli process, and is independent from $X_1, \dots, X_n$ + +**Memoryless property**: Let $n$ be a given time and let $\overline T$ be the time of the first success after +time $n$. Then $\overline T − n$ has a geometric distribution with parameter $p$, +and is independent of the RVs $X_1, \dots , X_n$. + +$$ +P(\overline T - n = t | \overline T \gt n) = (1 - p)^{t - 1}p = P(T = t) +$$ + +**Interarrival times** + +Denote the $k$th success as $Y_k$, the $k$th interarrival time as $T_k$. + +$$ +T_1 = Y_1, T_k = Y_k - Y_{k - 1}, k = 2, 3, \dots +$$ + +represents the number of trials following the $(k - 1)$th success until the next success. + +Note that + +$$ +Y_k = T_1 + T_2 + \dotsb + T_k +$$ + +Alternative description of the Bernoulli process: +* Start with a sequence of independent geometric RVs $T_1, T_2, \dots$ with common parameter p, and let these stand for the interarrival times. +* Record a success at times $T_1$, $T_1 + T_2$, etc. + +$$ +E[Y_k] = \frac{k}{p}\\ +\text{var}(Y_k) = \frac{k(1 - p)}{p^2} +$$ + +$$ +p_{Y_k}(t) = \binom{t - 1}{k - 1}p^k(1 - p)^{t - k} +$$ + +**Splitting of a Bernoulli process** + +Whenever there is an arrival, we choose to either keep it (with probability $q$), or to discard it (with probability $1 − q$). + +Both the process of arrivals that are kept and the process of discarded arrivals are Bernoulli processes, with success probability $pq$ and $p(1 − q)$, respectively, at each time. + +**Merging of a Bernoulli process** + +In a reverse situation, we start with two independent Bernoulli processes (with parameters $p$ and $q$ respectively). An arrival is +recorded in the merged process if and only if there is an arrival in at least one of the two original processes. + +The merged process is Bernoulli, with success probability $p+q−pq$ at each time step. + +## The Poisson Process + +### Definition +An arrival process is called a Poisson process with rate $λ$ if it has the following properties: + +**Time homogenity** + +$$ +P(k, \tau) = P(k \text{ arrivals in interval of duration }\tau) +$$ + +**Independence** + +Numbers of arrivals in disjoint time intervals are independent. + +**Small interval probabilities** + +$$ +\begin{cases} + 1 - \lambda\tau + o(\tau), & \text{if } k = 0,\\ + \lambda\tau + o_1(\tau), & \text{if } k = 1,\\ + o_k(\tau), & \text{if } k > 1. +\end{cases} +$$ + +### Bernoulli/Poisson Relation + +In a short time interval $\delta$ + +$$ +n = t / \delta\\ +p = \lambda\delta\\ +np = \lambda t +$$ + +For binomial PMF $p_S(k;n,p)$, + +$$ +\lim_{n\rightarrow \infty}p_S(k;n, p) = \lim_{n\rightarrow\infty}\frac{n!}{(n - k)!k!}p^k(1 - p)^{n - k} = \frac{(\lambda t)^k}{k!}e^{-\lambda t} = P(k, t) +$$ + +### PMF of Number of Arrivals $N$ + +$$ +P(k, \tau) = \frac{(\lambda\tau)^ke^{-\lambda\tau}}{k!} +$$ + +$$ +E[N_t] = \lambda t\\ +\text{var}(N_t) = \lambda t +$$ + +### Time $T$ of the first arrival + +$$ +F_T(t) = P(T \le t) = 1 - P(T \gt t) = 1 - e^{-\lambda t}, t\ge 0\\ +f_T(t) = \lambda e^{-\lambda t}, t\ge 0 +$$ + +**Memoryless property** The time to next arrival is independent of the past. + +### Interarrival times + +We also denote the time of the kth success as $Y_k$, and denote the +kth interarrival time as $T_k$. That is, + +$$ +T_1 = Y_1, T_k = Y_k - Y_{k - 1}, k = 2, 3, \dots +$$ + +Note that + +$$ +Y_k = T_1 + T_2 + \dotsb + T_k +$$ + +$$ +f_{Y_k}(y) = \frac{\lambda^ky^{k-1}e^{-\lambda y}}{(k - 1)!}, y\ge 0 +$$ + +### Merging Poisson Processes + +![](../images/prob/L14_1.jpg) + +$$ +P(\text{Arrival is red} | \text{1 arrival})\approx \frac{\lambda_1\delta}{(\lambda_1 + \lambda_2) \delta} +$$ + +![](../images/prob/L15_1.jpg) \ No newline at end of file diff --git a/blitherboom-blog/pages/posts/Physics.md b/blitherboom-blog/pages/posts/Physics.md new file mode 100644 index 00000000..67c409a9 --- /dev/null +++ b/blitherboom-blog/pages/posts/Physics.md @@ -0,0 +1,2066 @@ +--- +title: 大雾笔记 +date: 2022-09-14 17:20:10 +tags: note +katex: true +--- + +# 参考教材 + +嫌教材太简单可以看看 + +《热学》lhf例题很多,很详细,很多数学比教材难 + +《》 + +《新概念物理教程-力学》新颖,比较硬核。 + +《费恩曼物理学讲义》 + +《新概念物理教程-光学》公认最好教材 + +《光学》chb, lyp + +量子物理没有太好的参考书。 + +《原子物理学》杨福家编。现在没有原子物理了,只有量子物理。有时用经典方法,有时候用量子物理的方法。前几章和教材一致,实验讲得不错。 + +量子力学教程。周世勋。内容有点少。 + +《费恩曼物理学讲义》第3卷。相当有深度(量子物理)。 + +*Phyisics* Vol.1 & 2。难度介于大学物理学和物理系教材之间。 + + + +### 杂项 + +牛顿运动方程一般个数少,微分阶数高;哈密顿正则方程一般个数多,微分阶数低。 + +# 热学 + +## 温度 + +分子动理论:热学中比较古老的理论。 + +教材中关于统计物理的内容不够透彻。 + +建议学习分析力学(重点:哈密顿力学),对后续量子力学有帮助。固体物理也会使用相关技巧。哈密顿量,相空间,拉格朗日方程。不用看证明,能用就行。 + + + +### 热学研究内容与对象 + +内容:与热现象有关的性质和规律。 + +热现象:宏观上与温度有关,微观上与分子热运动有关。 + +对象:大量微观粒子构成的体积有限的物体-热力学系统。(量大:统计学规律。) + +经常讨论系统和外界(环境)。一种说法:宇宙是不是热力学系统?不是,因为宇宙之外没有外界。所以热二定律可能不适用于整个宇宙。 + +孤立系统:与外界没有任何相互作用。 + +绝热系统:有功的交换,没有热量交换 + +封闭系统:有能量交换,无粒子交换 + +开放系统:既有能量交换,也有粒子交换 + +### 热力学的研究方法 + +#### 热力学 + +宏观理论方法。依赖于实验。不涉及物质的微观结构和微观运动规律。具有极大的普遍性,可靠性。 + +#### 统计物理学 + +微观理论方法。从微观模型假设出发,力学 + 统计理论建立微观量和宏观量的关系。可解释本质,但是受模型局限。 + +### 几个重要概念 + +#### 平衡态 + +热力学系统内部,宏观上不存在能量和粒子的流动,系统宏观性质不随时间变化。(体积、压强、温度) + +热力学平衡条件: + +力学平衡条件:若系统与外界有力学作用,平衡时内外压强相等。 + +热平衡条件:若系统与外界可交换热量,平衡时内外温度应相等。 + +相平衡条件:若系统与外界处于不同相的共存状态,平衡时要达到力学平衡、热平衡以及相平衡。 + +化学平衡条件:浓度不同的系统混到一起,平衡时要满足上面三个条件,并且浓度均匀。 + +注意区分平衡态和稳定态: + +![../images/pht.png] + +#### 宏观量 + +描述系统宏观性质的量。可直接测量。 + +广延量:有累加性。如M, V, E... + +强度量:无累加性。如p, T... + +#### 微观量 + +描述微观粒子性质的量。需要间接测量。 + +如分子的m, v, d... + +#### 状态参量 + +描述系统平衡态及其宏观性质的物理量。 + +p, V, T, v, 内能E, 熵S, 焓H + +一组态参量对应一个平衡态。 + +实验表明:状态参量之间不是相互独立的。 + +常选p, V, T作为自变量,其他的当作函数(E, S, H)-热力学函数。 + +对物质量确定的单元(单一组元,不能由多种物质混合)单相(同一种状态,不能有固液同时存在等等)系统,p, V, T只有两个是独立的:T(p, V), E(p, V)。 + +统计物理:状态参量之间的偏导数关系。 + +#### 物态方程 + +两个最基本的热力学函数之一(物态方程和内能)。态参量之间的函数关系: f(T, p, V) = 0 + +通过测量确定。 + +理想气体物态方程: + +$pV = νRT$ + +$p = nkT$ + +$k = \frac{R}{N_A}$ + +$\nu$ 气体摩尔数 + +$k$ 玻尔兹曼常量 + +### 温度 + +#### 热平衡态 + +两个系统长时间热接触达到的共同平衡态。 + +#### 热力学第零定律 + +实验表明: A与C热平衡,B与C热平衡,A和B也必然保持热平衡。 + +非热接触的两个系统也可以处在同一个热平衡态。 + +温度:处于同一热平衡态下的热力学系统所具有的共同的宏观性质。 + +处在同一热平衡态的系统具有相同的温度。 + +#### 温标 + +理想气体温标;用理想气体做测温物质。单位: $K$(Kelvin), 范围适用 $> 0.5K$ + +实验表明:一定质量的理想气体在同一个热平衡态下,$pV$不变。 + +规定$T \propto pV$,水的三相点温度为$T_3 = 273.16K$ + +$$T = T_3\frac{pV}{p_3V_3} = 273.16\frac{pV}{p_3V_3}$$ + +热力学温标$T$:理论温标,与物质无关。 + +单位: $K$,适用于所有温度范围,在理想气体温标范围内与理气温标一致。 + +### 统计物理学的观点、概念简介 + +统计物理学包括平衡态统计理论,非平衡态统计理论和涨落理论。它从物质的微观结构和微观运动来阐明物质的宏观性质。其基本观点: + +- 宏观物体由大量的微观粒子(原子、分子、电子、光子等)构成。 +- 微观粒子的运动服从力学规律。原则上说服从量子力学规律,一定条件下可以用经典力学处理。 +- 从微观角度看,物体以一定的概率出现在各个微观状态上,物质的宏观性质就是物质微观性质的统计平均。宏观量是有关微观量的统计平均值。 + +#### 近独立子系统 + +构成系统的粒子间相互作用很弱,系统能量近似等于各粒子能量总和,如理想气体。 + +#### 微观状态(力学运动状态) + +##### 经典力学描述 + +常采用正则形式,即广义坐标和广义动量描述。 + +- 子相空间(μ空间):由粒子的广义坐标$q_i$和广义动量$p_i$($i = 1, \dots, r$, $r$是粒子自由度)构成的2r维空间。 + + 1组$(q_1, \dots, q_r, p_1, \dots, p_r)$的取值表示粒子的1个微观状态,对应于子相空间的一个点。 + + 更确切的说,在子相空间 $( q_1,... , q_r , p_1,..., p_r )$位置处的体积元 $d q_1...d q_r dp_1...dp_r$中的点,都是由$( q_1,... , q_r , p_1,..., p_r )$描述的相同的粒子微观状态。 + + 位形空间(坐标构成的空间),速度空间(速度构成的空间)。 + + 傅里叶变换和傅里叶级数的区别:一个离散,一个连续。 + +- 系统的微观状态是由所有粒子的广义坐标和广义动量描述的。 + +##### 量子力学描述 + +量子力学中假设运动状态用量子态描述。 + +- 粒子的微观状态用单粒子(量子)态描述。 + + 单粒子态由一组量子数描述:如 $|n, l, m_l, m_s >$ 。 1 组取值确定的$ |n, l, m_l, m_s > $表示 1 个单粒子态。 当粒子状态是由某个单粒子态描述时,称为粒子处于某个单粒子态,或粒子占据某个单粒子态 + +- 系统微观状态用多粒子(量子)态描述。 + + 对近独立子系统,多粒子态可由单粒子态表示: 系统所有粒子的 1 组单粒子占据态就表示系统的 1 个 多粒子态,即表示系统的 1 个 微观状态。 + +微观粒子全同性原理 + +全同粒子:内禀属性如质量、电荷、自旋等相同 + +微观粒子全同性原理是量子力学假设。 + +全同性原理:对全同粒子组成的系统,交换任意 2个全同粒子,系统微观状态不变。 + +泡利不相容原理:对全同费米子系统,不能有两个及以上的费米子占据同一单粒子态。 + +费米子:自旋为半整数;玻色子:自旋为整数。 + +#### 宏观状态和微观状态的关系 + +系统的宏观状态由宏观量表征,如 E、N、V。 + +系统的微观状态,如果用经典描述,则由所有粒子 的坐标和动量表征。 + +玻耳兹曼认为:从微观上看,对于一个系统的状态 的宏观描述是非常不完善的,系统的同一个宏观状 态实际上可能对应于非常非常多的微观状态,而这 些微观状态是粗略的宏观描述所不能加以区别的。 + + 这意味着宏观状态和微观状态、宏观量和微观量具 有内在联系,这种联系是种统计关系。 + +#### 统计规律性 + +统计物理发展早期,人们普遍认为:研究物体宏观 性质,应从求解粒子的力学运动方程出发来解决。 但由于粒子数太多,求解力学方程困难,迫不得已 得引入统计方法。而且这个统计是:宏观量是相应 微观量的长时间平均。 即原则上力学规律可完全决定物体宏观性质 + +这种观点无法解释根本问题:热现象的不可逆性。 因为把力学运动方程(牛顿方程或薛定谔方程)用 到微观粒子,是时间反演对称的 — 可逆的。 + +这表明仅通过力学规律来解释物体的宏观性质是 不可能的,而有赖于新的规律 — 统计规律。 + + + +力学规律是决定论性的,可表述为:在一定初始 条件下,某时刻系统必然处于一确定的运动状态。 + +统计规律可以表述为:在一定的宏观条件下,某 时刻系统以一定的概率处于某一微观状态。 + +即宏观状态与微观状态之间的联系是概率性的, 具有统计规律的特性,而不是决定论性的。 + +统计规律的稳定性:只要 N 足够大,每次得到的分布几乎相同 + +统计规律的涨落:每次实验中得到的比例 Ni /N 稍有差别。N 越大,涨落越小。 + +即对变量是离散取值的情况,直接采用概率, 对变量是连续取值的情况,需要引入概率密度。 + +热现象本质是统计规律的反映。 + +##### 平衡态统计理论的基本假设:等概率原理 + +处于平衡态下的孤立系统,系统各个可能的微观 状态出现的概率相等。 “可能的微观状态”是指孤立系统的宏观条件所 允许的那些微观状态,即这些微观状态对应于给 定的 E、V、N + +##### 平衡态下近独立子系统的统计规律 + +处于平衡态下的热力学系统,宏观状态不变,但 相应的微观状态不断变化,是一种动态平衡。 根据等概率原理,平衡态包含的微观状态数目是 最多的 — 最概然态 + +求统计分布函数:对于每个统计分布函数,可以计算它们对应的微观态数目(微观态数目是统计分布函数的函数)。在E, N不变的条件下,只要找到对应微观态数目最多的统计分布函数,就是平衡态的统计分布函数。 + +对近独立子系统,采用经典力学及等概率原理只能得到一种经典统计:麦克斯韦-玻尔兹曼统计;采用量子力学及等概率原理得到3种统计:麦克斯韦-玻尔兹曼统计,费米-狄拉克统计,玻色-爱因斯坦统计。 + +造成 3 种量子统计规律的原因是微观粒子的全同性原理和泡利不相容原理。 + +麦克斯韦-玻尔兹曼统计适用于定域子系统,费米 - 狄拉克统计、玻色 - 爱因斯坦统计适用于非定域 子系统。 + + 定域:全同粒子系统中的粒子的波包局限在空间 一定范围内,之间没有重叠,全同性原理 不起作用,可以通过位置分辨粒子。 + + 经典的和量子的麦克斯韦-玻尔兹曼统计在数学形 式上一致。而在一定条件下,量子的 3 种统计都可 退化为经典的麦克斯韦-玻尔兹曼统计 + +## 气体动理论 + +#### 气体动理论的基本观点 + +气体动理论(分子动理论),发展于 19 世纪下半 期,基于经典理论,是统计物理学的原型,被不断 补充发展完善成为统计物理学,其所得的结论可通 过统计物理得到。至今仍在诸多领域有重要应用。 + +1. 宏观物体是由大量分子、原子构成的,分子间 存在一定的间隙。 +1. 分子永不停息地作无规则运动 — 热运动 +1. 分子间存在一定的相互作用。 + +### 理想气体的压强 + +##### 关于理想气体的假设 + +###### 单个分子服从的力学规律 + +理想气体模型: + +大小:分子线度<<分子间平均距离 + +分子力:除碰撞的瞬间,在分子间、分子与器壁间无作用力 + +碰撞性质:弹性碰撞 + +服从规律:牛顿力学 + +###### 大量分子处于平衡态时的统计假设 + +(1)无外场时,分子在各处出现的概率相同 +$$n = \frac{\mathrm d N}{\mathrm d V} = \frac NV = \text{const}.$$ +(2)由于碰撞,分子可以有各种不同速度 + +速度取向各方向等概率: +$$\bar{v_x} = \bar{v_y} = \bar{v_z} = 0\\\\\bar{v_x^2} = \bar{v_y^2} = \bar{v_z^2} = \frac 13 \bar{v^2}$$ + +##### 理想气体压强公式 + +前提:平衡态,忽略重力,分子当成质点 +$$p = \frac13nm\bar{v^2} = \frac23n\bar\varepsilon_t, \\\\\bar\varepsilon_t = \frac12 mv^2$$ + +### 温度的统计意义 + +$$\bar\varepsilon_t = \frac{3p}{2n} = \frac{3nkT}{2n} = \frac32kT\\\\\sqrt{\bar{v^2}} = \sqrt{\frac{3kT}{m}} = \sqrt{\frac{3RT}{M}}$$ + +$T = 273K$, + +$\bar{\varepsilon}_t$数量级:$10^{-2}$eV + +$\sqrt{\bar{v^2}}$ + +$H_2$: $1.84\times 10^3m/s$ + +$O2$: $4.61\times 10^2m/s$ + +### 能量均分定理 + +自由度:决定物体空间位置的独立坐标数,用$i$表示 + +##### 单原子分子 + +平动自由度:$t = 3$ + +$i = 3$ + +##### 双原子分子 + +质心平动:$t = 3$ + +轴取向:$r = 2$ + +距离变化:$v = 1$ + +总自由度: $i = 6$ + +##### 多原子分子 + +设分子包含$N$个原子 + +$i = 3N$ + +$t = 3$ + +$r = 3$ + +$v = 3N-6$ + +##### 能量均分定理 + +一个平动自由度对应的平均动能为$\frac12kT$ + +考虑平动、振动和转动,由于分子的碰撞,分子平均动能均匀分配到每个自由度上。 + +在温度$T$的平衡态下,分子热运动的每个自由度对应的平均动能都等于$\frac12kT$。 + + + +普遍的能量均分定理: + +分子能量中每具有一个平方项,就对应一个$\frac12kT$的平均能量。 + +分子振动的动能和势能都是平方项,所以: + +$\bar\varepsilon_{vP} = \bar\varepsilon_{vk} = v\frac12kT$, $\bar\varepsilon_v = \bar\varepsilon_{vP} + \bar\varepsilon_{vk} = vkT$ +$$\bar\varepsilon = \bar\varepsilon _t + \bar\varepsilon_r + \bar\varepsilon_v = (t + r + 2v)\frac12kT$$ +通常情况下($T < 10^3K$),振动自由度被“冻结”,分子可视为刚性 + +刚性分子:$v = 0, i = t + r$ +$$\bar\varepsilon = \frac{t+ r}2kT$$ + +##### 理想气体内能 + +内能:系统内部各种形式能量的总和,不包括系统整体质心运动的能量 + +分子内部: $\bar\varepsilon = (t + r + 2v)\frac12kT$ + +分子之间:相互作用势能$\varepsilon_{\mathrm pij}$ + +内能:$E = N\bar\varepsilon + \sum_i\sum_{j$f(v)$一定要归一化!

例如求0到vp/2的平均速率,首先要将f(v)归一化成这个区间内的速率分布,而不是直接用全部速率分布

+$$\bar{\phi(v)} =\int_0^\infty \phi(v)f(v)\text dv$$ + +由麦克斯韦速率分布函数 + +$$\bar v = \sqrt{\frac{8kT}{\pi m}} = \sqrt{\frac{8RT}{\pi M}}$$ + +###### 方均根速率 + +$$\bar{v^2} = \int_0^\infty v^2f(v)\text dv = \frac{3kT}{m}\\\sqrt{\bar{v^2}} = \sqrt{\frac{3kT}{m}} = \sqrt{\frac{3RT}M}$$ + +##### 麦克斯韦速度分布律 + +$$\frac{\text dN}{N} = \left(\frac{m}{2\pi kT}\right)^{3/2}e^{-m(v_x^2 + v_y^2 + v_z^2)/2kT}\text{d}v_x\text{d}v_y\text{d}v_x$$ + +速度分量的分布函数 + +$$g(v) = (\frac m{2\pi kT})^{1/2}e^{-mv^2/2kT}$$ + +##### 分子碰壁数$Γ$ + +$$\Gamma = \frac14 n\bar v$$ + +##### 玻尔兹曼分布 + +###### 恒温气压公式 + +$$p = p_0e^{-mgz/kT}\\\\n = n_0e^{-mgz/kT}$$ + +###### 玻尔兹曼分布 + +$$\text dN_{\vec r} = n_0 \cdot e^{-\varepsilon_p(\vec r)/kT} \cdot \text d^3 \vec r\\\\\text d^3\vec r = \text dx \ \text dy \ \text dz$$ + +###### 玻尔兹曼-麦克斯韦分布 + +$$\text dN = n_0 \cdot (\frac m{2\pi kT})^{3/2} \cdot e^{-[\frac12 mv^2 + \varepsilon_p(\vec r)]/kT} \cdot \text d^3\vec r \cdot \text d^3 \vec v$$ + +能量简并:不同子相空间分子能量相等。 + +分子按能量分布: + +$$N(\varepsilon) = C \cdot w(\varepsilon) \cdot e^{-\frac{\varepsilon}{kT}}$$ + +$\varepsilon$为粒子的能量,$w(\varepsilon)$为具有此能量的体积元个数. + +### 范德瓦尔斯方程 + +#### 范氏气体模型 + +气体分子间的作用力:分子间的作用力很复杂,主要是电磁力,可以分为引力和斥力 + +范氏气体模型:对理想气体做两方面的修正。考虑分子体积、分子间作用力引起的修正。 + +![范氏气体](../images/physics/VanGas.png) + +* 分子是直径为d的刚球 +* 在$d\rightarrow s$的范围内,分子间有恒定引力 + +#### 范德瓦尔斯方程 + +范德瓦尔斯方程: + + +设: + +$\nu = 1 mol$ + +$p$ -- 实测气体压强 + +$V_m$ -- $1\ mol$气体容积 + +对理想气体:$pV_m = RT$ + +对真实气体: + +1. 分子体积引起的修正 + +分子自由活动空间的体积为$V_m - b$ + +$$p(V_m - b) = RT$$ + +$$ +p = \frac{RT}{V_m - b} +$$ + +2. 分子间引力引起的修正 + +气体分子间作用力一般表现为引力。 + +在容器内部,单个气体分子受到各个方向的平均引力相等,合力可以看作零。 + +但是在容器边缘,单个气体分子受到的引力是不对称的。气体分子所受的合力指向容器内部,因此撞击容器壁的气体分子动量比理想气体下的情况要小,宏观上形成的压强比理想气体情况要小。 + +$$ +p < \frac{RT}{V_m - b}\\ +$$ + +设 + +$$ +p = \frac{RT}{V_m - b} - p_{in} +$$ + +$p_{in} \propto nf_{合}, f_{合}\propto n \Rightarrow p_{in} \propto n^2 \propto \frac 1{V_m^2}$ + +最后得到: +$$ +(p + \frac a{V_m^2})(V_m - b) = RT +$$ + +对 ν mol 气体: + +$$ +(p + \nu^2 \cdot \frac a{V^2})(V - \nu b) = \nu RT +$$ + +常温常压下:$b/V_m \sim 10^{-3}, p_{in}/p \sim 10^{-2}$,这时分子体积和分子间的作用力修正可以忽略。 + +#### 气体的等温线 + +真实气体的等温线: + +![RealGasTemp](../images/physics/RealGasTemp.png) + +范氏气体的等温线: + +![VanGasTemp](../images/physics/VanGasTemp.png) + +如何计算临界参数: + +临界参数:临界点K对应的$p_K, V_K, T_K$ + +临界点K是等温线的拐点: + +$$ +\left(\frac{\partial p}{\partial V}\right)_{T = T_K} = 0\\ +\left(\frac{\partial^2 p}{\partial V^2}\right)_{T = T_K} = 0 +$$ + +K同时也是三次方程的三重根,因此可以通过假设$(V_m - V_{mK})^3 = 0$展开后和范德瓦尔斯方程对比系数求解。 + +#### 范氏气体内能 + +理想气体: $E(T) = i\nu RT / 2$ + +范氏气体:$V\uparrow \rightarrow p_{in}做负功\rightarrow 分子间势能E_p\uparrow$ + +要计算势能,首先要定义势能为0的状态:定义某种位形为0势能。其他状态的势能定义为从这种状态变形到0势能状态的过程中保守力的变化。 + +$$\mathrm dA = -p_{in}S\mathrm dl = -p_{in}\mathrm dV$$ + +设$E_p(V = \infty) = 0$。 + +$$ +E_p(V) = \int_V^\infty -p_{in}\mathrm dV = \int_V^\infty-\nu^2 \cdot \frac a{V^2}\mathrm dV = -v^2 \cdot \frac aV +$$ + +$$ +E = E_k + E_p = \frac i2\nu RT - \nu ^2\frac aV +$$ + +**结论:** +$$E(T, V) = \frac i2 \nu RT - \nu^2 \frac aV$$ + +#### 一个细节 + +为什么不考虑气体分子和容器壁分子间的引力? + +事实上,这引力确实存在。但是可以通过动量定理证明,碰撞过程这引力的作用总和为0。 + +### 气体分子的碰撞、平均自由程 + +平均碰撞频率和平均自由程 + +平均碰撞频率$\bar z$:单位时间内一个气体分子与其他分子碰撞的平均次数 + +平均自由程$\bar \lambda$:气体分子在相邻两次碰撞之间飞行的平均路程。 + +平均碰撞频率和平均频率之间关系 + +对象:平衡态下的理想气体 + +假定: + +(1)只有一种分子; + +(2)分子可视作直径为d的刚球; + +(3)被考察的分子以平均相对速率$\bar u$运动,其余的分子静止。 + +碰撞界面为$\sigma$。分子间平均相对速率为$\bar u = \sqrt 2 \bar v$。 + +$$ +\bar z = \sigma \bar u n = \pi d^2 n \bar u = \sqrt 2 \pi d^2 n\bar v +$$ + +平均自由程和压强、温度的关系: + +$$ +\bar\lambda = \frac {\bar v} {\bar z} = \frac 1{\sqrt2 \pi d^2 n} = \frac {kT}{\sqrt2\pi d^2p} \propto \frac{T}{p} +$$ + +### 气体输运过程 + +非平衡态下,气体内部各部分性质不均匀,就会产生热量、动量、质量的迁移,称为输运过程或内迁移过程。 + +气体输运过程包括:热传导、扩散和内摩擦(粘滞)。 + +输运现象的宏观实验定律和原因。 + +热传导 + +温度不均匀。实验定律:傅里叶定律,热传导方程。 + +考虑1维的情形。 + +$$ +\mathrm dQ = -\kappa \frac{\partial T}{\partial x}\mathrm dS \mathrm dt +$$ + +$$ +j(x, t) = \frac{\mathrm dQ}{\mathrm dS\mathrm dt} = -\kappa \frac {\partial T(x, t)}{\partial x} +$$ + +$j(x, t)$:热流密度,$\partial T/\partial x$:温度梯度。 + +温度梯度“力”导致热流。 + +> $T$在这里相当于电势,$-\partial T / \partial x$相当于电势的负梯度即电场强度,$j$相当于电流密度,$\kappa$相当于电导率。因此类比$\vec{J} = \sigma \vec{E}$有$j = -\kappa \partial T /\partial x$。类似的,也许可以推导出热阻的概念?热学的“麦克斯韦”方程组又是什么? + +统计物理给出的结论: + +$$ +\kappa = \frac 13 nm\bar v \bar \lambda c_V +$$ + +>如何理解此公式:热传导的本质是分子能量(热量)的交换,交换的热量等于粒子数乘以单个粒子交换的热量。 +> +>$m$为单个分子质量。$c_V$为定体热容。$n\bar v$用于描述$\mathrm dt$内穿过$\mathrm dS$的粒子数,$\bar\lambda$乘以$\partial T/\partial x$得到温度的变化量$\mathrm dT$ ,$m,c_V$与温度的变化量相乘,得到单个粒子交换的热量。 + +稳恒热流:$\frac{\mathrm dQ}{\mathrm dt} = C$,$j$, $T$与$t$无关。 + +$\kappa$称为导热系数,由气体特性和$T, p$决定。 + +扩散 + +原因:气体内部离子数浓度不均匀。 + +斐克定律 + +$$ +\mathrm dN = -D\frac {\partial n}{\partial x}\mathrm dS \mathrm dt +$$ + +>教材的表述为 +>$$ +\mathrm dM = -D\frac {\partial \rho}{\partial x}\mathrm dS \mathrm dt +>$$ +>这里的两个$D$是一样的。 + +统计物理给出的结论: + +$$ +D = \frac13\bar v\bar \lambda +$$ + +扩散流密度: + +$$ +j(x, t) = \frac {\mathrm dN}{\mathrm dS \mathrm dt} = -D\frac {\partial n}{\partial x} +$$ + +稳恒扩散流:$\frac {\mathrm dN}{\mathrm dt} = C$,$j$, $n$, 与$t$无关。 + +粒子数守恒方程 +$$ +\oiint_S j\cdot \vec {s} = -\frac {\mathrm dN}{\mathrm dt}, \nabla \cdot \vec j + \frac{\partial n}{\partial x} = 0. +$$ + +结合粒子数守恒方程(微分形式)和斐克定律得到扩散方程 + +$$ +\frac{\partial n}{\partial t} = D\frac{\partial^2 n}{\partial x^2} +$$ + +考试考定场稳恒流,不考内摩擦。 + +内摩擦(粘滞) + +根据流体力学,对定常流动的粘滞流体,流速不太大时(雷诺数小),出现层流。 + +粘滞定律(牛顿摩擦定律) + +$$ +\Delta F = - \eta \frac{\mathrm du}{\mathrm dz}\Delta S +$$ + +$$ +p = -\eta \frac{\mathrm du}{\mathrm dz} +$$ + +粘度和温度有关,气体粘度随温度增加,液体温度随温度减小。遵从粘滞定律的流体称为牛顿流体。 + +内摩擦原因:流速不均匀。 + +统计物理给出的结论: + +$$ +\eta = \frac 13 nm\bar v\bar \lambda +$$ + +## 热力学第一定律 + +### 准静态过程 + +准静态过程:过程的任一时刻,系统都处于平衡态— 一系列平衡态组成的理想化过程。 + +若外界条件改变时,能保证和系统相应的强度量之间差无穷小,则过程是准静态的。 + +弛豫时间τ:平衡破坏到恢复平衡的时间. + +当$\Delta t_{过程} > \tau$时,过程就可视为准静态过程。 +。 +### 功 + +体积功:$\mathrm{\bar dA} = p\mathrm dV$ + +系统对外界做功:$A = \int_{V_1}^{V_2}p\mathrm dV$是一个过程量。 + +通过做功改变系统热力学状态,微观上是分子规则运动的能量通过碰撞转变为无规则运动的能量。 + +### 内能,热量和热力学第一定律 + +内能:定义为$E_2 - E_1 = A_{1\rightarrow 2}$(绝热过程) + +内能通过绝热功度量。 + +热量:定义为$Q = (E_2 - E_1)$(无功过程) + +微观本质是分子无规则运动的能量通过碰撞从高温物体向低温物体传递。 + +热力学第一定律: + +$Q = \Delta E + A$ + +$\mathrm {\bar{d}}Q = \mathrm d E + \mathrm{\bar{d}}A$ + +热力学第一定律是一条实验定律,适用于任何热力学系统的任何过程。 + +### 热容量: + +$$ +C = \frac{\mathrm dQ}{\mathrm dT} +$$ + +定体热容量:$C_v = \left(\frac{\mathrm dQ}{\mathrm dT}\right)_V$ + +定压热容量:$C_p = \left(\frac{\mathrm dQ}{\mathrm dT}\right)_p$ + +摩尔热容量: +$$ +C_m = \frac1\nu\frac{\mathrm dQ}{\mathrm dT} +$$ + +对应地有定体摩尔热容量和定压摩尔热容量。 + +理想气体内能:$\Delta E = \nu C_{V, m}\Delta T$。(推导:内能变化与过程无关,假设先等体后等温,等体过程无功只有热交换,等温过程内能不变。) + +迈耶公式: + +$$ +C_{p, m} - C_{V, m} = R +$$ + +(推导:用等压过程计算内能的变化,与定体过程的结论比较一下可得。) + +理想气体热容量理论公式: + +$$ +C_{V, m} = \frac i2R, C_{p, m} = \frac{i+2}{2}R +$$ + +推导:结合理想气体内能公式。 + +定义比热容比:$\gamma = C_{p, m}/C_{V, m}$ + +### 绝热过程 + +系统和外界没有热交换的过程。 + +理想气体的准静态绝热过程: + +> $$ +> 0 = p\mathrm dV + \nu C_{V, m}\mathrm dT\\ +> p\mathrm dV + V\mathrm dp = \nu R\mathrm dT\\ +> R = C_{p, m} - C_{V ,m} +> $$ +> +> 得到: +> $$ +> \frac{\mathrm dp}{p} = -\gamma\frac{\mathrm dV}V +> $$ + +两边积分得到: +$$ +pV^{\gamma} = C, TV^{\gamma - 1} = C, p^{\gamma - 1}T^{-\gamma} = C +$$ + +绝热功 + +$$ +A = \int_{V_1}^{V_2} p\mathrm dV = C \int_{V_1}^{V_2}\frac 1{V^{\gamma}}\mathrm dV = \frac{C}{1 - \gamma}(V_2^{1 - \gamma} - V_1^{1 - \gamma}) =\frac{p_2V_2 - p_1V_1}{1 - \gamma} +$$ + +绝热功等于内能的减少量: + +$$ +A = -\Delta E = \nu C_{V, m}\Delta T +$$ + +理想气体的多方过程 + +多方过程:热容量$C$为常数的过程 + +多方过程方程:$pV^n = \text{const}$ + +其中,$n = (C - C_p)/(C - C_V) = (C_m - C_{p, m})/(C_m - C_{V, m}) = \text{const}$ + +如果为绝热过程则$C = 0$,$n = \gamma$,从而$pV^{\gamma} = \text{const}$。 + +如果为等温过程则$C = \infty$,$n = 1$,因此$pV = \text{const}$。 + +绝热自由膨胀过程(非准静态过程!!): + +理想气体:$Q = 0, A = 0 \Rightarrow E_1 = E_2$ + +真实气体:若分子间以引力为主, $T_2 < T_1$,以斥力为主,$T_2 > T_1$。 + +焓:气体的绝热节流过程是等焓过程,即$H = E + pV$为常数,对于非理想气体而言,内能不仅与温度有关,也与体积有关(焦耳-汤姆孙效应)。 + +绝热自由膨胀:初末状态在等温线上,但是过程中不是平衡态。 + +准静态等温膨胀:吸热用来做功。 + +准静态绝热膨胀:内能的减少量用来做功。 + +![](../images/physics/guocheng.png) + +循环过程: + +系统,如热机中的工质,经一系列变化的回到初态的整个过程。 + +状态图: + +![](../images/physics/xunhuantu.png) + +热循环: + +![](../images/physics/rexunhuan.png) + +蒸汽机的效率约为十几%,内燃机20-30%。 + +制冷循环: + +![](../images/physics/zhilengxunhuan.png) + +制冷系数: + +$$ +w = \frac{Q_2}{A} = \frac{Q_2}{Q_1 - Q_2} +$$ + +### 卡诺循环 + +卡诺循环是一种可逆循环,包括两个等温过程和两个绝热过程。它的效率为 + +$$ +\eta = 1 - \frac{|Q_2|}{Q_1} = 1 - \frac{T_2}{T_1} +$$ + +卡诺循环的效率仅与热源的温度比有关。 + +由卡诺定理可以证明,卡诺循环的效率与工质无关。因此,不妨设工质为理想气体,利用理想气体等温和绝热过程方程得到效率公式。 + +## 热力学第二定律 + +开尔文表述:不可能将热量从低温热源搬运到高温热源,而不产生其他影响。(制冷系数不可能为无穷大) + +克劳修斯表述:不可能将功全部转化为热。(热机效率不可能为1) + +开尔文表述和克劳修斯表述是等价的。事实上,任何关于热现象不可逆的描述都是等价的,它们要么同时成立,要么同时不成立。因此,描述热现象的方向性,只需要举一个例子即可。 + +### 卡诺定理 + +在温度相同的高温热源和温度相同的低温热源之间工作的一切热机,可逆热机的效率最大。 + +推论:一切可逆热机,只要它们的高温热源的温度相等,低温热源的温度相等,效率就相等。 + +对于制冷机: + +可逆制冷机的制冷系数最大。 + +所有2热源可逆制冷机制冷系数都相等,等于卡诺制冷机的制冷系数。 + +### 热力学温标 + +根据卡诺定理,可逆热机的效率只与温度有关。因此可以用效率,或者说热量比来定义温标。 + +在热力学温标下,低温热源的温度不能为0,否则可逆热机的效率为1. + +### 任意可逆循环的效率 + +$$ +\eta \le 1 - \frac {T_2}{T_1} +$$ + +其中,$T_1$,$T_2$分别为循环中工质的最高和最低温度。 + +### 克劳修斯熵公式 + +热力学第零定理导出了温度,热力学第一定律导出了内能,热力学第二定律则导出了熵。 + +可逆循环可以拆成若干小卡诺循环,每个卡诺循环满足 + +可逆循环有克劳修斯等式 +$$ +\oint_R \frac{\mathrm {\bar d} Q}{T} = 0 +$$ + +因此得到一个与路径无关的状态函数。 + +熵与状态有关,和过程无关。即便过程是不可逆过程。 + +但是,仅当过程为可逆过程时才有$\mathrm dS= \mathrm{\bar d}Q/T$。 + +对于可逆过程: + +$$ +T\mathrm dS = \mathrm{\bar d}Q = \mathrm dE + p\mathrm dV +$$ + +因而可以用$E, V$表示熵: +$$ +\mathrm dS = \frac 1T \mathrm dE + \frac pT \mathrm dV = \frac 1T() +$$ + +### 克劳修斯不等式 + +不可逆循环有 +$$ +\oint_{Ir} \frac{\mathrm {\bar d} Q}{T} < 0 +$$ + +因而有熵增加原理: + +$$ +\int_{1_{Ir}}^{2} + \int_{2_R}^1 < 0\Rightarrow S_1 - S_2= \int_{1_{Ir}}^2 +$$ + +# 振动和波动 + +## 波动 + +### 多普勒效应 + +一般形式: + +![](../images/DSA/Duopule.jpg) + +机械波不存在多普勒效应。 + +电磁波的多普勒效应: + +![](../images/DSA/waveDuopl.jpg) + +横向多普勒效应:$\theta = \pi /2$ + +纵向多普勒效应:$\theta = 0,\pi$ + +### 激波 + +马赫数:$\frac{v_s}{u} = \frac 1{\sin\alpha}$ + +# 光学 + +光学分为几何光学,波动光学和量子光学。 + +## 光的相干叠加 + +光源: +1. 普通光源:自发辐射。不同原子发光独立、不相干;同原子不同次发光独立、不相干。 +2. 激光光源:受激辐射。光放大,全通光子,相干光,波列长,相干性好。 + +光的相干性: +光学中强调电磁波的电场矢量$\vec E$:光矢量 + +相干条件:光矢量有平行分量,频率相同,相差恒定。 + +电磁波叠加的强度公式推导: +$$ +I = \sqrt{\varepsilon / \mu}\left<\vec E \cdot \vec E \right>_t \\ + +I \propto \left<\vec E \cdot \vec E \right>_t \\ + +叠加的电磁波:\vec E_1 + \vec E_2\\ + + +矢量的点乘运算可得叠加后的强度:\\ + +I = I_1 + I_2 + 2\sqrt{\varepsilon / \mu}\left<\vec E_1 \cdot \vec E_2 \right>_t + +$$ + +对光的相干叠加,用光矢量的平行分量描述光场--标量波函数。 + +$$ +I = I_1 + I_2 + 2\sqrt{I_1I_2}\cos \Delta \varphi +$$ + +其中$\Delta\varphi = -k(r_2 - r_1) + (\varphi_{20} - \varphi_{10})$为相位差。 + +在上面两式中,若$\vec E_1 \cdot \vec E_2 \ne 0$或者$\Delta\varphi \ne \pm\frac{\pi}{2}...$,则满足相干的条件。 + +条纹的明显程度用衬比度衡量:$V = (I_{max} - I_{min})/(I_{max} + I_{min})$ + +不同的位置$\Delta\varphi$不同,因而对应的$I$不同,造成了干涉条纹的出现。$I_1 = I_2$时$V=1$,$I_1 \ne I_2$时,$V \ne 1$。 + +普通光源获得相干光的途径一般有分波阵面法(双缝干涉)和分振幅法(薄膜干涉)。 + +### 双缝干涉 + +![](../images/physics/shuangfeng.jpg) + +明纹:$\delta = \pm k\lambda$ + +暗纹:$\delta = \pm (2k + 1)\frac \lambda 2$ + +$(k\in N)$ + +条纹间距:$\Delta x = \frac{D}{d}\lambda$ + +$\Delta \varphi \approx \frac{d\sin \theta}{\lambda}2\pi$ + +时间相干性(光的颜色): + +光的非单色性: + +准单色光:由某个中心频率或波长附近的频率或波长连续分布的光构成。采用谱密度函数描述。 + +![](../images/physics/准单色光.jpg) + +造成谱线宽度的原因:自然宽度、多普勒增宽、碰撞增宽 + +非单色性对干涉条纹的影响: + +![](../images/physics/非单色光.jpg) + +从图中可以看出,如果某个位置谱线中波长最长的成分的k级明纹和波长最短的成分的(k+1)级明纹重合,则在这个位置以后的条纹看不清楚了。 + +可以解得最大相干级次:$k_M = \lambda/\Delta\lambda$,进而有最大波程差:$\delta_M = \lambda^2/\Delta\lambda$。 + +相干长度等于波列长度。 + +通常用相干时间(光通过相干长度所需的时间)$\tau = \delta_M / c$ 衡量光的单色性。相干时间或相干长度越长,则单色性越好。 + +空间相干性(光的宽度): + +较宽的光源会导致明纹的非相干叠加,使衬比度下降。 + +设光的宽度为$b_0$,则看到干涉条纹的条件是$b_0 < \frac{R}{d}\lambda$,这一上界称为光源极限宽度。 + +固定b和R,则得到$d < \frac{R}{b}\lambda$,上界称为相干间隔。 + +光源中心对两孔的张角为$\theta = \frac{d}{R} < \frac{\lambda}{b}$,上界称为相干孔径角。 + +### 光程 + +用于计算光经过不同介质的相差。 +$\Delta\varphi = \frac{2\pi r}{\lambda}$。 + +透镜不产生附加光程差。 + +### 薄膜干涉 + +为什么要薄?相干长度(时间相干性)限制。 + +薄膜干涉有实际意义的是等倾条纹和等厚条纹。 + +光程差 +$$ +\delta = 2ne \cos r + \frac{\lambda}{2} +$$ + +e为膜厚度。 + +等厚条纹: + +厚度不同,角度相同 + +单色平行光入射,近似垂直于膜表面,因而$i, r \approx 0$ + +$$ +\delta = 2ne + \frac{\lambda}{2} +$$ + +劈尖: + +由于明纹需满足$\delta = k\lambda$,暗纹需满足$\delta = (2k+1)\lambda/2$,故相邻亮纹所在的厚度差为$\Delta e = \lambda / (2n)$,而条纹间距为$L = \Delta e / \theta = \lambda / (2n\theta)$ + +牛顿环: + +![](../images/physics/niudunhuan.jpg) + +可以得到暗环半径公式:$r_k=\sqrt{kR\lambda}$ + +总结:条纹跟着厚度走。 + +等倾条纹: + +厚度相同,角度不同。 + +光程差(记!) +$$ +\delta = 2ne \cos r + \frac{\lambda}{2} = 2e\sqrt{n^2 - n^{\prime2}\sin ^2 i} + \frac \lambda2 +$$ + +等倾条纹实验通常采用面光源,因为透镜会把方向相同的光汇聚到一点,因而条纹的非常鲜明,衬比度很高,不会出现光源宽度和条纹衬比度的矛盾。 + +应用:增透膜和增反膜 + +### 迈克尔逊干涉仪 + +平行:等倾条纹 + +倾斜:等厚条纹 + +条纹缩进N个,代表厚度变化: + +$$ +\Delta d = \frac{\lambda}{2n} = \frac {\lambda}{2} +$$ + +在光路上放一个介质,条纹移动N个: + +$$ +\delta = 2(n - 1)l = N\lambda +$$ + +简而言之,一个条纹对应光程变化一个波长,厚度的变化(介质变化折算成厚度变化)乘以2等于光程的变化,因为一来一回经过了两次。 + +## 衍射 + +菲涅尔衍射和夫琅禾费衍射。 + +惠更斯-菲涅尔原理 + +夫琅禾费衍射研究光源和投影面在无限远处的情形。采用透镜将无限远转化为有限远。 + +### 单缝衍射(夫琅禾费) + +利用半波带法计算明暗纹位置: + +中央明纹:$a\sin \theta = 0$ + +暗纹:$a\sin \theta = \pm k\lambda$ + +明纹(近似):$a\sin \theta = \pm (2k + 1)\frac \lambda 2$ + +上述的$k$不能为0。因为如果k=0,即中央明纹,它没有半波带,因此要单独考虑。 + +光强公式:$I_p = I_0(\frac{\sin \alpha}{\alpha})^2$ + +其中$I_0$为中心亮纹强度,$\alpha = \frac{\pi a \sin \theta}{\lambda}$ + +条纹宽度: + +条纹宽度的定义:两个相邻暗纹之间的距离,就是它们之间那个条纹的宽度。 + +中央明纹角宽度:$\Delta \theta_0\approx 2\frac{\lambda}{a}$,线宽度:$\Delta x_0 \approx 2 f \frac{\lambda}{a}$ + +其他明纹线宽度:$\Delta x \approx f\frac{\lambda}{a}$ + +### 光栅衍射 + +光栅是由衍射单元(狭缝、反射面等)排列成的具有空间周期性结构的光学元件。 + +光栅常数d-空间周期性结构常数 + +正入射光栅方程:$d\sin \theta = \pm k\lambda$。(明纹位置) + +暗纹方程:$d\sin \theta = \pm k\lambda + \frac{m}{N}\lambda$ + +主极大缺级公式:$k = k^\prime d / a$ + +主极大半角宽:$\frac {\lambda}{N d \cos \theta_k}$ + +斜入射光栅方程:$d(sin\theta - \sin i) = \pm k\lambda$ + +斜入射可以获得更高级次的条纹,但是观察到的条纹总数不变。 + +调节入射角i或者波长$\lambda$,衍射角$\theta_k$也会改变。对于0级衍射光,$\sin \theta_0 = \frac{\lambda}{2\pi d}\Delta \varphi_{in}$ + +光学仪器的分辨本领: + +艾里斑半角宽$D\sin \theta_1 \approx 1.22\lambda$ + +瑞利判据:一个象斑中心在另一个象斑边缘。 + +根据瑞利判据得到透镜分辨本领(最小分辨角):$R = \frac{D}{1.22\lambda}$ + +光栅光谱: + +取决于光栅的色散能力和谱线(条纹)的线宽度 + +角色散本领:$D_{\theta} = \frac{\delta \theta}{\delta \lambda}$ + +色分辨本领:$R = \frac{\lambda}{\delta \lambda} = Nk$,$\delta \lambda$,$\lambda $取较小者的波长,$k$是主极大级数。 + +## 偏振 + +### 定义 + +线偏振光:光矢量做同向振动,方向不变。 + +圆偏振光:光矢量的端点是圆。 + +椭圆偏振光:光矢量的端点是椭圆。 + +非偏振光:例如自然光。它的振动方向随机,各个方向振幅相等。自然光可以分解为两束垂直振动,振幅相等,相差随机的线偏振光。 + +部分偏振光:自然光+完全偏振光。 + +偏振度:$P = \frac{I_p}{I_t} = \frac{I_p}{I_n + I_p}$ + +### 起偏与检偏 + +偏振片:利用二向色性。有微晶型和分子型。 + +线偏振光的起偏:通过偏振片。 + +马吕斯定律:$A = A_0 \cos \alpha, I = I_0 \cos^2 \alpha$ + +### 反射与折射中的偏振 + +S分量:垂直于入射面。P分量:平行于入射面。 + +反射光S分量多,折射光P分量多。 + +当$i = i_0$使得反射光只有S分量,折射光大部分是P分量。称为布儒斯特角。$i_0 + r_0 = 90\degree$,因而有布儒斯特定律:$\tg i_0 = \frac{n_2}{n_1}$ + +玻璃片堆可以增强反射光的强度,增加折射光的偏振程度。 + +散射引起光的偏振: + +微粒散射:丁达尔效应 + +分子散射:纯净气体、液体的散射。 + + +双折射现象: + +1束光入射到各向异性介质内,产生2束折射光。o光为寻常光,符合折射定律;e光为非常光,不符合折射定律一般,也不一定在入射面内。o,e光都是线偏振光,振动方向互相垂直。 + +晶体光轴:是晶体中的特殊方向,光在晶体中沿该方向传播不发生双折射。方解石是单轴晶体。云母是双轴晶体。 + +主平面:晶体中光的传播方向与晶体光轴构成的平面。o光振动方向垂直于主平面,e的振动方向在主平面内。只有当光轴在入射面内,o光主平面、e光主平面、入射面才重合。 + +折射角度不同的本质是不同角度下光的传播速度不同。据此区分正晶体和负晶体: + +$v_o$是o光速度,$v_e$是e光垂直光轴方向速度。o光是各向同性的,e光沿平行光轴方向的速度和o光相同,e光沿所有方向的速度构成一个旋转椭球面。 + +![](../images/physics/shuangzheshe.jpg) + +正晶体:$v_o > v_e$ + +负晶体:$v_o < v_e$ + +定义主折射率:$n_o = c/v_o, n_e = c/v_e$ + +利用惠更斯作图法可以讨论单轴晶体的光传播情况: + +以负晶体为例。 +* 若光轴平行于晶体表面,自然光垂直入射:o和e方向相同,速度不同,仍然是双折射; +* 光轴平行晶体表面,且垂直入射面,自然光斜入射:e光也满足折射定律,折射率为$n_e$; +* 光轴与晶体表面斜交,自然光垂直入射:e光偏离入射方向,惠更斯波面是斜椭圆。 + +研究晶片时,o光和e光(垂直振动和平行振动)是独立的正交的分量。垂直振动不会变成平行振动,平行振动也不会变成垂直振动。 + +双折射:两个垂直方向的线偏振光的不同速度造成的。 + +旋光:两个不同旋转方向的圆偏振光的不同速度造成的。 + +# 量子物理 + +## 黑体辐射 + +热辐射 + +物体受热发出电磁辐射。热辐射是连续谱,温度升高,短波成分增加。 + +平衡热辐射:物体温度不变时产生的热辐射。单位时间内物体吸收能量等于辐射能量。 + +光谱幅出度(单色幅出度) + +单位面积内单位频率发射的电磁波能量。 + +$$ +M_\nu = \frac{\mathrm d E_\nu(T)}{\mathrm d\nu} +$$ + +总幅出度 + +$$ +M(T) = \int_0^\infty M_\nu(T)\mathrm d\nu +$$ + +单色吸收比 + +$$ +\alpha_\nu(T) = \frac{\mathrm d E_{\nu(吸收)}}{\mathrm d E_{\nu(入射)}} +$$ + +黑体 + +能吸收所有频率的电磁波,没有反射。$\alpha_{\nu}=1$。 + +基尔霍夫辐射定律: + +$$ +\frac{M_{\nu i}}{\alpha_{\nu i}} = M_{\nu 黑体} +$$ + +实验定律: + +维恩位移定律:$\nu_m = C_\nu T$, $\lambda_m = b/T$ + +注:$\lambda_m \nu_m \ne c$。 + + +斯特藩-玻尔兹曼定律:$M(T) = \sigma T^4$,$\sigma$为斯特藩-玻尔兹曼常量。 + +韦恩公式:低频段不符合; + +瑞利-金斯公式:高频段不符合。 + +普朗克能量子假设:$\varepsilon = h\nu$ + +普朗克公式: + +$$ +M_\nu(T) = \frac{2\pi h}{c^2}\cdot \frac{\nu^3}{e^{h\nu/kT} - 1} +$$ + +由它可以导出所有其他热辐射公式。 + +## 光电效应 + +自学。 + +## 光的二象性 + +光子理论:能量$\varepsilon = h\nu$。光强:$I = N \cdot h\nu$,N是光子数流通量。 + +解释光电效应: + +$$ +\frac 12 mv_m^2 = h\nu - A +$$ + +光的粒子性: + +$$ +p = \frac h \lambda \\ +E = h\nu \\ +m = \frac{h\nu}{c^2} +$$ + +解释干涉和衍射: + +光子在某处出现的概率是由该处的光强决定的:$I \propto \frac 1 {r^2}$,光子分布概率的不同导致了光强的不同。也就是说,光子的波动性表现为概率波。 + +光子在某处出现的概率和该处光强(光振幅的平方)成正比。 + +## 康普顿散射 + +散射波出现新的波长:$\Delta \lambda = \lambda_C(1 - \cos\varphi)$ + +利用光子理论解释:光子和“静止”的“自由”电子碰撞过程动量守恒,能量守恒。 + +解得$\Delta \lambda = \frac{h}{m_0c}(1 - \cos \varphi)$ + +如果光子撞到内层电子,则能量不变,因而存在原波长。 + +自由电子只能散射光子,不能吸收光子。如果吸收了,根据能量守恒和动量守恒,解得v=c,违反了相对论。 + +光电效应不考虑动量守恒,因为可见光、紫外线的能量低,电子不能视为自由,光子-电子不能视为动量守恒的系统。也因此,可见光观察不到康普顿效应。 + +## 概率波和概率幅 + +物质波的本质: + +德布罗意认为是引导物质运动的“导波”;(本质不明确) + +薛定谔认为波是基本的,电子是“波包”;(波包是不稳定的,而电子是稳定的) + +另一个观点:粒子是基本的,物质波是电子相互作用形成的(被电子双缝实验否定) + +波恩的解释:物质波是描述粒子在空间概率分布的“概率波”。 + +量子力学的基本假设之一:微观粒子的状态用波函数描述 + +概率波波函数(概率幅):复函数$\Psi (\vec r, t)$ + +波函数没有直接的物理意义。复函数模的平方$|\Psi (\vec r, t)|^2$表示概率密度。 + +波函数需要满足标准条件: + +有限性:$\iiint_{\Delta V}|\Psi|^2 \mathrm dV$有限 + +归一性:$\int_\Omega |\Psi(\vec r, t)|^2 \mathrm dV = 1$ + +单值性:波函数是单值函数。 + +连续性:波函数和它的一阶导数是连续的。 + +双缝的波函数:等于通过上缝和下缝的波函数的线性叠加。$\Psi_{12}=\Psi_1+\Psi_2$。(一个基本假设) + +微观粒子波动性实质是波函数的叠加性。 + +结合测量理解。 + +态叠加原理:$\Psi = \sum_n C_n\Psi_n$。其中$|C_n|^2$是该粒子处于$\Psi_n$状态的概率。 + +一维自由粒子的波函数: + +$$ +\Psi(x, t) = A e^{i(px-Et)/\hbar} +$$ + +概率密度$|\Psi|^2 = |A|^2 = \text {const.}$ + +波粒二象性: + +粒子性:具有能量$E$和动量$\vec p$。非经典粒子!没有轨道概念。 + +波动性:具有波长$\lambda$和频率$\nu$。非经典波!非真实物理量的波动。 + +## 不确定关系 + +$$ +\left<\vec r|\Psi\right> +$$ + +不确定度:$\Delta A = \sqrt{\overline{(A - \bar A)^2}}$ + +坐标和动量的不确定性关系: + +$$ +\Delta x \cdot \Delta p \ge \frac \hbar 2 +$$ + +因而微观粒子没有“轨道”。 + +能量和时间的不确定性关系: + +$$ +\Delta E \cdot \Delta t \ge \frac{\hbar}{2} +$$ + +时间不是力学量,它只是一个参数。位置,动量,能量等都是力学量。 + +## 薛定谔方程 + +定义 + +$$ +i\hbar \frac{\partial \Psi}{\partial t} = \hat {H} \Psi +$$ + +哈密顿算符:$\bar {H} = -\frac{\hbar ^2}{2m}\nabla^2 + U(\vec r, t)$ + +若势函数不显含时间,则哈密顿算符$\hat H$称为能量算符。此时薛定谔方程可以通过分离变量法求解。 + +### 定态薛定谔方程-能量本征方程 + +分离变量法求解: + +若势函数不显含t,则可设: + +$$ +\Psi(\vec r, t) = \Phi(\vec r) \cdot T(t) +$$ + +得到: + +$$ +i\hbar \frac{\mathrm dT(t)}{\mathrm d t}\frac 1{T(t)} = [\hat H\Phi (\vec r)]\frac{1}{\Phi(\vec r)} = E +$$ + +$$ +T(t) = Ce^{-\frac{i}{\hbar}Et}\\ +() +$$ + +E称为能量本征值(后面会讲什么叫本征值),对应的$\Phi_E$称为本征波函数。 + +定态:能量取确定值的状态,对应薛定谔方程的特解:$\Psi_E(\vec r, t) = \Phi e^{-\frac{i}{\hbar}Et}$. + +对不同的势函数和能量区间,能量的本征值可能取连续的值,也可能取分立的值。设E取分立值,$\{E_n, n = 1, 2, 3, \dots\}$,对应的本征波函数$\Psi_E (\vec r, t) = \Phi_E(\vec r)e^{-\frac{i}{\hbar}Et}$ + +下面通过求解一维定态薛定谔方程来讨论两类问题: + +本征值问题:给定$U(x)$,求$E_n$和$\Phi_n(x)$。 + +散射问题:$E$已知,射向势垒$U(x)$,计算粒子穿透势垒的概率。 + +## 无限深方势阱中的粒子 + +背景:长度为$a$的导体中自由移动的电子,只能在导体中自由运动,而不能离开导体。 + +$|x| > a/2$时,$U(x) \rightarrow \infty$; + +$|x| \le a/2$时,$U(x) = 0$。 + +在$|x| > a/2$区间,$\Phi_1 = 0$。 + +在$|x| \le a/2$区间,$\frac{\mathrm d^2 \Phi_2}{\mathrm dx^2} + \frac{2mE}{\hbar^2}\Phi_2 = 0$ + +记$k = \frac{2mE}{\hbar^2}$。解得$\Phi_2 = A\sin(kx + \varphi)$。 + +求解定态的常规手法:利用波函数的三个条件,即单值、有限、连续,确定$A, k, \varphi$。 + +利用连续条件,波函数在势阱边界处连续: + +$$ +A\sin(\frac{ka}{2} + \varphi) = 0, A\sin(-\frac{ka}{2} + \varphi) = 0.\\ + +\Rightarrow k = \frac{n\pi}{a}, \varphi = \frac{l\pi}{2} +$$ + +从而 +$$ +E = \frac{\pi^2\hbar^2}{2ma^2}n^2 \ (n = 1, 2, 3, \dots) +$$ + +最低能量$E_1$被称为零点能。 + +大量子数情况下,能量趋向于连续。 + +$$ +l = 0, \varphi = 0, \Phi_2 = A\sin \frac{n\pi}{a}x = \Phi_{on},满足边界连续需要n为偶数\\ +l = 1, \varphi =\pi /2 , \Phi_2 = A\cos \frac{n\pi}{a}x = \Phi_{en},满足边界连续需要n为奇数\\ +l \ge 2,只差个符号,不影响|\Phi|^2,不再考虑。 +$$ + +求$A$: + +归一化:$\int_{-a/2}^{a/2}|\Phi_{on}|^2 \mathrm dx = 1$, 得到$A = \sqrt \frac2a$ + +$$ +\Phi_{on} = \sqrt{\frac 2a}\sin \frac{n\pi}{a}x, n = 2, 4, 6, \dots\\ +\Phi_{en} = \sqrt{\frac 2a}\cos\frac{n\pi}{a}x, n = 1, 3, 5, \dots +$$ + +定态: + +$$ + +\Psi_n (x, t) = \Phi_n(x) \cdot e^{-\frac i\hbar Et} + +$$ + +被称为驻波解(时间项指数为纯虚数,展开可以写成三角函数)。概率密度$|\Psi_n(x, t)|^2 = |\Phi_n(x)|^2$ + +## 势垒穿透 + +### 粒子进入势垒 + +背景:金属与半导体接触处,势能隆起形成势垒。粒子以能量为$E(E < U_0)$的状态自由入射。 + +$$ +U(x) = 0, x \le 0;\\ +U(x) = U_0, x \gt 0. +$$ + +量子力学认为有一部分粒子会穿透势垒。不仅有反射,还有投射。 + +定态薛定谔方程: + +$$ +\Phi^{\prime\prime}(x) + \frac{2m}{\hbar^2}(E - U(x))\Phi(x) = 0 +$$ + +$x \le 0$: +$$ +k_1 = \sqrt{2mE/\hbar^2} > 0\\ +\Psi_1^{\prime\prime} + k_1^2 \Psi_1 = 0 +$$ + +$x \gt 0$: +$$ +ik_2 = \sqrt{2m(E - U_0)/\hbar^2} (k_2 > 0)\\ +\Psi_2^{\prime\prime} + (ik_2)^2\Psi_2 = 0 +$$ + +通解(利用了$x\rightarrow\infty$时$\Psi_2$的有界性): + +$$ +\Psi_1(x) = Ae^{ik_1x} + Be^{-k_1x}(表现为入射和反射波)\\ +\Psi_2(x) = Ce^{k_2x}(表现为透射波) +$$ + +粒子可以出现在势垒区!表现为电子溢出金属表面,形成金属表面的一层电子气。 + +势垒区的概率密度:$|\Psi_2(x)|\propto e^{-\frac{2x}{\hbar}\sqrt{U_0 - E}}$ + +波可以穿过有限宽势垒,以平面波的形式继续前进。称为量子隧穿效应。 +$\Psi_3(x) = Se^{i\frac {\sqrt{2mE}}{\hbar} x}$ + +扫描隧道显微镜:原理是量子隧穿效应,可以用来观测物质表面结构。 + +![](../images/physics/STM.jpg) + +$$ +i \propto Ue^{-C\sqrt{\varPhi}d} +$$ + +$\varPhi$为样品表面平均势垒高度。 + +## 一维谐振子 + +$$ +U(x) = \frac 12 kx^2 = \frac 12m\omega^2x^2, \omega = \sqrt{\frac km} +$$ + +求解定态薛定谔方程得到 +$$ +E_n = (n + \frac 12)\hbar \omega = (n + \frac 12)h\nu +$$ +零点能:$\frac{h\nu}{2}$。间距:$h\nu$。能量本征函数不用记。 + +定态概率密度: + +经典情况下:平衡位置处$\vec v$最大,停留时间最短,出现概率最小,振幅最大的时候$\vec v$为0,出现概率最大。量子数n趋于无穷时,量子概率分布趋于经典概率分布。 + +如果$E< U$,隧穿效应仍然存在。 + +## 力学量算符 + +以位矢$\vec r$为自变量的空间,称为“坐标表象”。在坐标表象中,动量和位矢不存在对应关系$\vec p = \vec p(\vec r)$(不确定关系)。 + +量子力学将动量、角动量、能量等力学量“算符化”。力学量算符是量子力学的一个基本假设。 + +### 力学量算符的引入 + +定义能量算符$\hat {E} \equiv i\hbar \frac{\partial}{\partial t}$,与表象无关。 + +坐标表象中定义动量算符$\hat{\vec p} = -i\hbar\nabla$,坐标算符$\hat{\vec r} = r$。 + +由于坐标表象下坐标算符就是坐标,因此势能算符$\hat{U} = U(\vec r)$。动能算符$\hat{E_k} = \frac{(-i\hbar\nabla)\cdot (-i\hbar\nabla)}{2m} = -\frac{\hbar^2}{2m}\nabla^2$ + +角动量算符$\hat{\vec L} = \hat{\vec r}\times \hat{\vec p} = -i\hbar\vec r \times \nabla$。如果用球极坐标,可得$\hat{L_z} = -i\hbar \frac{\partial}{\partial \varphi}$。角动量算符的模方由极角和方位角的导数组成:$\hat{L}^2 = -\frac {\hbar^2}{\sin \theta}\frac{\partial}{\partial \theta}(\sin \theta\frac{\partial}{\partial \theta}) +\frac{\hat{L_z^2}}{\sin^2\theta}$ + +### 本征值和本征函数 + +本征方程:$\hat{A}\Psi_n = A_n\Psi_n$。其中$A_n$为本征值,$\Psi_n$是$A$取$A_n$时的本征态,称为本征函数。 + +本征值就是相应力学量的可能取值。 + +$\hat A$的本征函数系${\Psi_n}$构成正交、归一的完备函数系。一维情况的归一化:$\int_{-\infty}^{+\infty}\Psi_n^*(x)\Psi_n(x)\mathrm dx = 1$。正交性:$\int_{-\infty}^{+\infty}\Psi_m(x)\Psi_n(x)\mathrm d x = \delta_{mn}$. + +本征函数的完备性:在相同的函数空间内,任一物理上合理的归一化波函数,都可以由力学量A的本征函数系线性展开,即$\Psi = \sum_{n}C_n(t)\Psi_n(x)$。 + +### 态叠加原理: + +线性展开公式: + +$$ +\Psi(x, t) = \sum_{n }C_n(t)\Psi_n(x) \ (假设是归一化的) +$$ + +基本假设之一。 + +### 力学量的测量原理 + +量子力学假设:在$\Psi(x,t)$态上测量$A$,则$\Psi(x, t)$一定向着$A$的某个本征态$\Psi_n$塌缩,测量结果为$A_n$。 + +特别地,如果$\Psi = \Psi_n$,则测量结果是确定的,为$A_n$。 + +测量结果中$A_n$出现的概率为$|C_n(t)|^2$。 + +$$ +\bar A = \sum_n |C_n(t)|^2A_n = \int_{-\infty}^{+\infty}\Psi^*(x, t)\hat A\Psi(x, t)\mathrm dx +$$ + + +## Dirac符号 + +### 量子态 + +本征值离散的:$\ket{n}$ + +本征值是连续的:$\ket{P_x}, \ket{x}$ + +它们各自张开一个线性空间。 + +### 内积空间 + +左矢与右矢一一对应,左矢张开一个共轭线性空间。 + +$\ket{A}$和$\ket{B}$的内积(复内积):$\langle B|A\rangle$ + +左矢空间与右矢空间通过复内积练习,称为内积空间。 + +### 线性算符 + +$$ +\hat{L}\ket{A} = \ket{B} +$$ + +满足: +* $\hat L (\ket{A} + \ket {B}) = \hat L\ket{A} + \hat L\ket{B}$ +* $(\hat F + \hat G)\ket{A} = \hat F \ket{A} + \hat G\ket{A}$ + +* $\hat F(\hat G \ket{A}) = (\hat F \cdot \hat G)\ket {A}$ + +共轭算符:$\bra{A}\bar{\hat L}$与$\hat L \ket{A}$一一对应,将$\bar{\hat L}$或者$\hat L ^+$称为共轭算符。 + +厄米算符:$\bar {\hat L} = \hat L$。 + +算符是向右结合的。 + +### 算符本征方程 + +$$ +\hat L \ket{L_n} = l_n\ket{L_n}\\ + +\hat L\ket{n} = l_n\ket{n} +$$ + +$l_n$是本征值,$L_n$是本征态。 + +由测量原理,本征值必须是实数。所以可以观测的力学量对应的算符都是厄米算符。 + +### 态叠加原理 + +离散谱: + +$$ +\bra{m}n\rangle = \delta_{mn}\\ +\ket{\psi} = \sum_n C_n\ket{n}\\ +概率幅:\bra{m}\psi \rangle = C_m\\ +\ket{A} = \sum_{n}(\bra{n}A\rangle)\ket{n} = \left(\sum_n \ket{n}\bra{n}\right)\ket{A}\\ +\Rightarrow \sum_n \ket{n}\bra{n}=1(本征矢的完备性表示) +$$ + +连续谱: + +$$ +\bra{x_0^\prime}x_0\rangle = \delta(x_0^\prime - x_0)\\ +\ket{\psi} = \int_{-\infty}^{\infty}C(x_0)\ket{x_0}\mathrm dx_0 \\ +概率幅:\bra{x_0^\prime}\psi\rangle = C(x_0^\prime)\\ +\ket{\psi} = \int_{-\infty}^{\infty}\bra{x_0}\psi\rangle\ket{x_0}\mathrm dx_0 = \left(\int_{-\infty}^{\infty}\ket{x_0}\bra{x_0}\mathrm dx_0\right)\ket{\psi}\\ +\Rightarrow \int_{-\infty}^{\infty}\ket{x_0}\bra{x_0}\mathrm dx_0 = 1(连续谱的完备性方程) +$$ + +注:$C(x_0) = \bra{x_0}\psi\rangle$就是波函数$\psi(x_0)$。$|\bra{x_0}\psi\rangle|^2 = |\psi(x_0)|^2 = \psi^*(x_0)\psi(x_0)$是概率密度。 + +### 正则量子化假设 + +对易关系:$[\hat A, \hat B]= \hat A\hat B - \hat B\hat A$,若$[\hat A , \hat B]=0$,则称$A$与$B$对易,否则称不对易。 + +正则量子化假设: + +$$ +[\hat{x}, \hat{p_x}] = i\hbar, +[\hat{y}, \hat{p_y}] = i\hbar, +[\hat{z}, \hat{p_z}] = i\hbar +$$ + +其余$x, y, z, p_x, p_y, p_z$的组合均对易。 + +满足$\hat{\vec A}\times \hat{\vec A} = i\hbar \hat{\vec A}$的算符被称为角动量。所有的角动量算符都满足这个关系。例如$\hat L = \hat r\times \hat p$,可以利用正则量子化假设对三个坐标进行计算验证。 + +$\hat A$和$\hat B$可以同时测准的充分必要条件: + +$$ +[\hat A, \hat{B}] = 0\Leftrightarrow 有共同本征态 +$$ + +简并:1个本征值对应m个量子态,称为m重简并。 + +产生简并的原因:对称性=>守恒量。 + +如果$\hat A$是m重简并的,只测量得到本征值A,无法确定对应的量子态。但是如果同时测量对易的$\hat B$,就可以确定对应的$|A, B_i\rangle$,则对应的A的量子态是$|A_i\rangle$。 + +力学量完全集:能完备描述、确定量子态的力学量算符必须包含$\hat H$。 + +$\hat H$是核心力学量。 + +$$ +[\hat A, \hat H]=0\Leftrightarrow \hat A是守恒量 +$$ +选择力学量的完全集,就是选择守恒量的完全集。 + +## 原子中的电子 + +### 氢原子理论 + +巴耳末公式->里德伯方程->波尔氢原子理论 + +氢原子理论: + +定态条件 + +电子绕核作圆周运动,有确定能量,不辐射能量-经典轨道+定态 + +频率条件 + +电子在定态之间跃迁满足:$\nu = (E_i - E_f)/h$ + +轨道角动量:$L_n = mv_nr_n = n\hbar$,轨道半径$r_n = n^2r_1$ + +能级公式:$E_n = -13.6eV/n^2$ + +类氢离子能级:核外只有一个电子,核电荷数大于1.例如$He^+, Li^{2+}$ + +评价: + +波尔理论解释了氢原子和类氢离子光谱的波长和频率。 + +但是不能解释氢原子的光谱线强度,也不能解释其他原子的光谱结构。 +* 与经典电磁理论矛盾 +* 角动量量子化条件是硬加的 +* 卢瑟福的质疑:电子知道要往$E_2$跳才能往$E_2$跳,但是又必须先跳过去才能知道要往$E_2$跳 +* 薛定谔的非难:当电子离开$E_1$态之后,进入$E_2$态之前,它在哪里,是什么状态? + +轨道概念不再适用。定态、能级、跃迁频率条件、角动量量子化仍然被认为是正确的。 + +### 氢原子的量子力学处理 + +求解量子问题的要点之一:确定体系的力学量完全集,即力学量可以同时测准,具有共同本征态,相应量子数集可完备地描述体系状态。 + +通常选择守恒量完全集,和体系对称性有关。 + +氢原子问题的守恒量完全集:$\hat H, \hat L^2, \hat L_z$ + +**角动量量子化:** + +处于中心力场的氢原子电子,角动量守恒。 + +求$\hat L_z$的本征值: + +$$ +\hat L_z = -i\hbar \frac{\partial }{\partial \varphi}\\ + +\hat L_z \varPhi = L_z \varPhi\Rightarrow \varPhi = Ae^{\frac{i}{\hbar}L_z\varphi} +$$ + +根据标准条件(周期性),$\varPhi(\varphi) = \varPhi(\varphi + 2\pi)$,带入解得$L_z = m_l\hbar$,$m_l = 0, \pm1, \pm2,\dots$称为磁量子数。 + +对应的本征函数:$\varPhi_{m_l}(\varphi) = Ae^{im_l\varPhi} = \frac{1}{\sqrt{2\pi}}e^{im_l\varphi}$ + +求$\hat L^2$的本征值: + +结论:$L^2 = l(l+1)\hbar^2$,$l = 0, 1, 2, \dots$称为角量子数。 + +($\hat L^2$和$\hat L_z$具有的共同本征值为球谐函数$Y_{ml}(\theta, \varphi)$) + +角动量的空间量子化 + +$L = \sqrt{l(l+1)}\hbar > L_z = m_l\hbar \Rightarrow m_l = 0, \pm1, \pm2,\dots, \pm l$。作矢量图可知,角动量有$2l+1$种取向。 + +**能量量子化** + +(省略公式) + +$l = 0, 1, \dots, n - 1$ + +$\hat H, \hat L^2, \hat L_z$的共同本征态就是定态。 + +能量的本征值只与主量子数n有关,因而出现了能量简并,不同的角量子数和磁量子数可以对应相同的能量本征值。同能量的本征值态称为能级简并态,包含的态数目称为能级简并度。 + +角量子数$l = 0, 1, 2...$对应的状态分别称为$s, p, d...$,从概率波图像可以看出,角量子数低的电子更容易靠近原子中心。 + +### 电子自旋 + +轨道角动量产生磁矩: +$$ +\hat{\vec \mu} = -\frac{e}{2m_e}\hat{\vec L} +$$ + +玻尔磁子: + +$$ +\mu_B = \frac{e\hbar}{2m_e} +$$ + +利用本征值的定义不难推出z方向的磁矩: +$$ +\mu_z = -m_l \cdot \mu_B +$$ + +斯特恩-盖拉赫实验 + +理论分析: + +磁矩在外磁场中有势能:$E = -\vec \mu \cdot \vec B$ + +轨道磁矩在z方向受力: + +$$ +F_z = \frac{\partial E}{\partial z} = \mu_z\frac{\partial B_z}{\partial z} = -m_l\mu_B\frac{\partial B_z}{\partial z} +$$ + +由于$m_l$的$2l+1$种取值,对应的原子束应该在z方向上分裂成奇数条线。 + +![](/source/images/physics/abaaba.jpg) + +问题:$Ag, H$等原子束($l = 0$)出现了2条线而不是一条线,矛盾。 + +电子自旋的假设: + +* 电子不是质点,而是自旋的小球,具有固有的自旋角动量$\vec S$和自旋磁矩$\vec \mu_S$ +* $S = \sqrt{s(s+1)}\hbar$,其中$s = \frac 12$称为自旋量子数 +* $S_z = m_s\hbar$,$m_s = \pm\frac 12$,称为自旋磁量子数 +* 自旋磁矩和自旋角动量满足$\hat {\vec \mu_S} = -\frac{e}{m_e}\hat {\vec S}$,进而推出$\mu_{S,z}=\pm \mu_B$ + +“自转小球”模型仍存在缺陷:电子表面的速度会超过光速。 + +但是这些假设成功解释了原子光谱的精细结构和反常塞曼效应。 + +量子力学的解释: + +* 自旋是与时空无关的内禀运动,一种新的自由度,一种新的角动量,无经典对应 +* 自旋、磁矩和静止质量、电荷一样,是反映微观粒子固有属性的基本量 +* 电子的自旋是一种相对论效应,被自动地包含在相对论波动方程(Dirac方程)中。 + +电子的总角动量: + +$$ +\hat {\vec J} = \hat {\vec L} + \hat {\vec S} +$$ + +$\hat {\vec J}$也是量子化的,大小为: +$$ +J = \sqrt{j(j + 1)}\hbar +$$ + +前文已说过如下定义: +>满足$\hat{\vec A}\times \hat{\vec A} = i\hbar \hat{\vec A}$的算符被称为角动量。所有的角动量算符都满足这个关系。例如$\hat L = \hat r\times \hat p$,可以利用正则量子化假设对三个坐标进行计算验证。 + +可以验证$\hat {\vec J }\times \hat {\vec J } = i\hbar \hat {\vec J }$。因此总角动量还是角动量。 + +这一角动量的合成被称为自旋——轨道耦合。$j$称为总角动量量子数。 + +$$ +l = 0: +\\ +j = s = \frac 12, m_j = -\frac 12, +\frac 12\\ +l \ne 0:\\ +j = l + s = l + \frac 12, m_j = -(l + \frac 12), \dots, l + \frac 12;\\ +j = l - s = l - \frac 12, m_j = -(l - \frac12), \dots, l - \frac12 +$$ + +碱金属原子光谱: + +碱金属的原子能级既和$n$有关,又和$l$有关。 + +轨道角动量对原子的影响包括轨道贯穿和原子实极化,导致相应能级能量降低。 + +因此原来相同能级的$3s,3p,...$会分裂成不同能级的轨道。 + +碱金属原子光谱的精细结构: + +电子的轨道运动会使得它感受到原子绕它转动的磁场$\vec B_{Nuc}$的作用。 + +电子自旋磁矩$\vec \mu_s$和$\vec B_{Nuc}$的相互作用就是自旋轨道耦合,是相对论效应。 + +于是能级在自旋轨道耦合的影响下进一步分裂,形成了能级精细结构。 + +### 微观粒子全同性原理 + +两个微观粒子的全部内禀属性相同称为全同粒子。对调全同粒子不会影响系统的状态。 + +数学上对应地表现为波函数模方相同,进而有波函数对称或者反对称。 + +对称的波函数表达式: + +$$ +\psi(q_1, q_2) = \frac {1}{\sqrt 2}[\phi_A(q_1)\phi_B(q_2) + \phi_A(q_2)\phi_B(q_1)] +$$ + +反对称的波函数表达式: + + +$$ +\psi(q_1, q_2) = \frac{1}{\sqrt{2}}[\phi_A(q_1)\phi_B(q_2) - \phi_A(q_2)\phi_B(q_1)] +$$ + +如果$\phi_A=\phi_B$,则反对称波函数为0。 + +费米子是自旋为半整数的粒子。它是波函数反对称的粒子。由此得到泡利不相容原理:全同费米子系统不能有两个及以上的费米子占据同一单粒子态。 + +玻色子是自旋为0或者整数的粒子。它是波函数对称的粒子。玻色子不受泡利不相容原理的限制。 + +费米统计: + +$$ +N(E) = \frac{1}{e^{(E - \mu)/kT} + 1} +$$ + +$\mu = \mu(T)$是粒子化学势。 + +玻色统计: + +$$ +N(E) = \frac{1}{e^{(E - \mu)/kT} - 1} +$$ + +对所有温度T,$0\le N(E)\lt \infty$。 + +玻色-爱因斯坦凝聚。 + +当$E$很高时,$(E - \mu) >> kT$。退化为麦克斯韦-玻尔兹曼统计。 + +### 原子核外电子的排布 + +4个量子数$n,l,m_l,m_s$可以完备描述原子的电子运动状态。 + diff --git a/blitherboom-blog/pages/posts/PhysicsExercise.md b/blitherboom-blog/pages/posts/PhysicsExercise.md new file mode 100644 index 00000000..97f60f43 --- /dev/null +++ b/blitherboom-blog/pages/posts/PhysicsExercise.md @@ -0,0 +1,15 @@ +--- +title: 大雾习题笔记 +date: 2022-10-04 19:12:17 +tags: note +--- + +# 热学 + +***气体压强越小,理想气体状态方程就越准确。*** + +![](../images/physics/Exer9.29.jpg) + +***双原子分子的压强公式是$2n\bar\varepsilon_k/5$吗*** + +无论分子有多少个原子,根据统计理论推算微观压强公式都应该是$p = 2n\bar\varepsilon_t/3$。原因是微观压强公式只考虑平动动能,不考虑转动和振动动能(显然转动和振动不会对压强造成影响)。而$\bar\varepsilon_k = \bar\varepsilon_t + \bar\varepsilon_r + \bar\varepsilon_v$。 \ No newline at end of file diff --git a/blitherboom-blog/pages/posts/Python-OJ.md b/blitherboom-blog/pages/posts/Python-OJ.md new file mode 100644 index 00000000..ff4c1f38 --- /dev/null +++ b/blitherboom-blog/pages/posts/Python-OJ.md @@ -0,0 +1,101 @@ +--- +title: Python-OJ +katex: true +date: 2023-10-09 12:49:57 +tags: +--- + +## idea + +python语言以其时间性能和空间性能低下著称,在各类 OJ 竞赛中尤为劣势。因此,优化 python 语言的空间和时间成为了一种可以研究的技巧() + +* 使用 python 练习 Codeforce 最新赛题 +* 比较 test case 的通过时间,从而得出优化结论 + +### 解释器的选择 + +Codeforce 官网称,采用 PyPy 运行 python 代码的速度远快于原生 python 解释器。 + +《much faster》 + +![alt](../images/oj/1.jpg) + +建议一个不快就换另一个 + +### python 时间优化技巧 + +**list.pop()很占用时间** + +赛题为 `Codeforces Round 902 (Div. 1, based on COMPFEST 15 - Final Round)` + +优化前的代码: + +~~~python +def single(n, p, a, b): + all_len = n + person_list = list(range(all_len)) + person_list.sort(key=lambda x:b[x]) + cost = p + informed_len = 1 + while informed_len < all_len: + index = person_list.pop(0) + item_a = a[index] + item_b = b[index] + if item_b < p: + if item_a < all_len - informed_len: + # continue + informed_len += item_a + cost += item_a * item_b + else: + # end + rest_len = all_len - informed_len + cost += rest_len * item_b + break + else: + rest_len = all_len - informed_len + cost += rest_len * p + break + + return cost +~~~ + +结局:`Test: #8, time: 1000 ms., memory: 12104 KB, exit code: -1, checker exit code: 0, verdict: TIME_LIMIT_EXCEEDED` + +优化后的代码: + +~~~python +def single(n, p, a, b): + all_len = n + person_list = list(range(all_len)) + person_list.sort(key=lambda x:b[x]) + cost = p + informed_len = 1 + front = 0 + while informed_len < all_len: + index = person_list[front] + item_a = a[index] + item_b = b[index] + if item_b < p: + if item_a < all_len - informed_len: + # continue + informed_len += item_a + cost += item_a * item_b + else: + # end + rest_len = all_len - informed_len + cost += rest_len * item_b + break + else: + # end + rest_len = all_len - informed_len + cost += rest_len * p + break + front += 1 + + return cost +~~~ + +结局:`Accepted`。在 test #8上:`Test: #8, time: 171 ms., memory: 12140 KB, exit code: 0, checker exit code: 0, verdict: OK` + +pop会删除列表的元素,因此需要多余的时间。故采用下标记录列表的顶层元素更节约时间。 + diff --git a/blitherboom-blog/pages/posts/Signal-and-Systems.md b/blitherboom-blog/pages/posts/Signal-and-Systems.md new file mode 100644 index 00000000..9cd88d04 --- /dev/null +++ b/blitherboom-blog/pages/posts/Signal-and-Systems.md @@ -0,0 +1,2749 @@ +--- +title: Signals and Systems +date: 2023-02-22 09:46:36 +tags: note +katex: true +--- + +March 15 +## Basic +### Classification +Deterministic & random + +Periodic/non-periodic + +Continuous/Discrete(time) + +Analog/Digital(Amplitude & time) + +### Operations + +Shifting + +Reflection + +Scaling + +Diffrential + +Integral + +Addition + +Multiplication + +Convolution + +$$ +f_1(t) * f_2(t) = \int_{-\infty}^{\infty}f_1(\tau)f_2(t-\tau)\mathrm d\tau +$$ + +### Singularity Signals + +#### Unit ramp function +$$ +R(t) = 0, t\lt 0; t, t>0 +$$ + +#### Unit step function +$$ +u(t) = 0, t<0;1/2, t=0;1, t>0 +$$ + +#### Rectangular pulse +$$ +u(t) - u(t-t_0) +$$ + +#### Sign function +$$ +sgn(t) = 1, t>0;-1, t<0 +$$ +define $sgn(0)=0$, then $sgn(t)=2u(t)-1$ + +#### Unit impulse function +Dirac definition +$$ +\int_{-\infty}^{\infty}\delta(t)\mathrm dt=1\\ +\delta(t)=0(t\ne 0) +$$ +$$ +\delta(t)=\lim_{\tau \rightarrow0}\left[U(t+\frac\tau2)-U(t-\frac \tau 2)\right] +$$ + +$$ +\int_{-\infty}^{\infty}\delta(t)f(t)=f(0)\\ +\int_{-\infty}^{\infty}\delta(t - t_0)f(t)=f(t_0)\\ +\delta(t)=\delta(-t)\\ +\frac{d}{dt}u(t)=\delta(t) +$$ + +#### Impulse doublet function + +$\delta^\prime(t)$ +Double impulses at t=0 which are mirror-imaged with their amplitude of infinite. + +$$ +\int^{\infty}_{-\infty}\delta^\prime(t)\mathrm dt=0\\ +\int^{\infty}_{-\infty}f(t)\delta^\prime(t)\mathrm dt=-f^{\prime}(0)\\ +\text{shifted:}\int^{\infty}_{-\infty}f(t)\delta^\prime(t-t_0)\mathrm dt=-f^{\prime}(t_0)\\ +$$ +![](../images/ss/lec2_.jpg) + +### Signal Decomposition + +$$ +f(t) = f_D+f_A(t)\\ +f(t)=f_e(t)+f_o(t)\\ +f(t)=f_r(t)+jf_i(t)\\ +f_r(t)=\frac{1}{2}\left[f(t)+f^*(t)\right]\\ +f_i(t)=\frac{1}{2}\left[f(t)-f^*(t)\right] +$$ + +#### Pulse Component + +$$ +f(t)=\int_{-\infty}^{\infty}f(t_1)\delta(t-t_1)\mathrm dt_1 +$$ + +We also have orthogonal function decomposition(Chap.3, Chap.6). + +### System modeling and Classification + +System model can be represented by math equation(including input-output description and state variables or state equation) graphic symbol and block diagrams. + +We use the input-output description mostly. If controling something internal is needed, state euqtion is useful. + +Block diagram: + +![](../images/ss/lec2_2.jpg) +![](../images/ss/lec2_3.jpg) + +### System classification + +#### Linear or Non-linear + +$$ +e_1(t)\rightarrow r_1(t), +e_2(t)\rightarrow r_2(t)\Rightarrow\\ +a_1e_1(t)+a_2e_2(t)\rightarrow a_1r_1(t)+a_2r_2(t) +$$ + +#### Time-variant or Time-invariant + +#### Memory or Memoryless + +with memory: dynamic system, differential equation + +without memory: instant system, algebraic equation + +#### Continuous or Discrete + +Continuous Differential equation + +Discrete Difference equation + +#### Lumped- or Distributed-Parameter + +Lumped: constant coefficient differential equation + +Distributed: partial equation + +#### Causal or Non-Causal + +when $t<0, e(t)=0 \Rightarrow t<0, r(t)=0$ Generic definition? + +the future state cannot have effect on now state. The state of causal system can only be determined by now and past states. + +#### Reversible or irreversible + +different input to different output, otherwise irreversible. + +### LTI System + +#### Linearity + +Linearity leads to superposition and homogeneity. + +#### Time-Invariant + +a time shift in the input results in a same time shift in the output. + +$$ +e(t)\rightarrow r(t)\Rightarrow e(t-t_0)\rightarrow r(t-t_0)\\ +\lim_{\Delta t\rightarrow 0}\frac{e(t)-e(t-\Delta t)}{\Delta t}\rightarrow \lim_{\Delta t\rightarrow 0}\frac{r(t)-r(t-\Delta t)}{\Delta t}\\ +\frac{\mathrm de(t)}{dt}\rightarrow \frac{\mathrm dr(t)}{dt} +$$ + +If every coefficient is time independent, the system is time invariant. + +## Time-Domain(TD) Analysis + +$$ +C_0\frac{d^nr(t)}{dt^n}+C_1\frac{d^{n-1}r(t)}{dt^{n-1}} + ... + C_nr(t)\\ +=E_0\frac{d^me(t)}{dt^m}+E_1\frac{d^{m-1}e(t)}{dt^{m-1}}+...+E_me(t) +$$ + +**Three Steps** + +* Homogeneous +* Particular +* Calculation on coefficients + +### Determining Coefficients + +If functions are continuous, we can get their boundary conditions by determining the derivatives. + +Then the coefficients can be solved by multipling the inverse of Vandermonde matrix with the boundary condition matrix. + +#### Zero-input and -state Responses + +**Zero-input response** The response caused by the initial state (i.e., energy originally stored in the system), and it is denoted by $r_{zi}(t)$ + +**Zero-state response** $r(0_-)\equiv 0$, the response caused only by the external excitation and it is denoted by $r_{zs}(t)$ + +![](../images/ss/lec3_1.jpg) + +![](../images/ss/lec3_2.jpg) + +The combination of zero-input response and the zero-state response is not necessarily linear, since the existence of constant. If one of them vanishes, the other is linear. + +### Impulse and Step Responses + +**Impulse Response** the zero-state response $h(t)$ to $\delta (t)$, which can be equalized to the initial condition. + +Note: normally $n>m$. + +**Unit Step Response** The zero-state response $g(t)$ to $u(t)$ + +There might be a forced term in $g(t)$. + +$$ +g(t) = \int_0^th(\tau)d\tau +$$ + +### Convolution + +Zero-state required + +$$ +e(t) = \int_{-\infty}^{\infty}e(\tau)\delta(t-\tau)\mathrm d\tau\\ +\Rightarrow r(t)=\int_{-\infty}^{\infty}e(\tau)h(t-\tau)\mathrm d\tau\\ +\Rightarrow r(t)=e(t)*h(t) +$$ + +the definition of convoluiton: + +$$ +f_1(t)*f_2(t)=\int_{-\infty}^{\infty}f_1(\tau)f_2(t-\tau)\mathrm d\tau +$$ + +**Integral interval** $e(t)=0, \forall t<0$, $h(t)=0,\forall t<0$, so $r(t)=\int_0^t{e(\tau)h(t-\tau)\mathrm d\tau}$ + +The condition for applying convolution: + +* For linear system ONLY +* For time variant systems, $h(t, \tau)$ means response at time $t$ generated by the impulse at time $\tau$, then $r(t)=\int_0^th(t,\tau)e(\tau)\mathrm d \tau$; for time-invariant system is a special case, $h(t,\tau)=h(t-\tau)$. + +**The Properties of Convolution** The commutative property, the distributive property, the associative property + +Differential: + +$$ +(f_1(t)*f_2(t))^\prime=f_1^\prime(t)*f_2(t) +$$ + +Integral + +$$ +\int f_1(t)*f_2(t)=f_1(t) * \int f_2(t) +$$ + +$$ +(f_1(t) * f_2(t))^{(i)}=f_1^{(j)}(t) * f_2^{(i-j)}(t) +$$ + +**Convolution with $\delta (t)$ or $u(t)$** + +(1) $f(t) * \delta(t) = f(t)$ + +(2) $f(t) * \delta(t - t_0) = f(t-t_0)$ + +(3) $f(t) * u(t) = \int_{\infty}^{t}f(\tau)\mathrm d\tau$ + +(4) $f(t) * \delta^\prime(t) = f^\prime(t)$ + +## Fourier Transform + +### Fourier Series + +requirements: + +* has finite number of discontinuities +* has finite number of maxima and minima +* $\int_{t_0}^{t_0+T_1} |f(t)|\mathrm dt < \infty$ + +$$ +\begin{align*} +f(t)&=a_0+\sum_{n=1}^\infty \left[a_n\cos(n\omega_1)t + b_n\sin(n\omega_1t)\right]\\ +&=c_0 + \sum_{n=1}^\infty c_n\cos \left(n\omega_1t+\varphi_n \right)\\ +&=\sum_{n=-\infty}^{\infty}F_ne^{jn\omega_1 t} +\end{align*} +$$ + +$$ +\begin{align*} + a_0&=\frac{1}{T_1}\int_{t_0}^{t_0+T_1}f(t)\mathrm dt=c_0\\ + a_n&=\frac{2}{T_1}\int_{t_0}^{t_0+T_1}f(t)\cos(n\omega_1t)\mathrm dt\\ + b_n&=\frac{2}{T_1}\int_{t_0}^{t_0+T_1}f(t)\sin(n\omega_1t)\mathrm dt\\ + c_n&=\sqrt{a_n^2+b_n^2}\\ + \varphi_n&=-\tg^{-1}\frac{b_n}{a_n}\\ + F_n&=\frac 1{T_1}\int_{t_0}^{t_0+T_1}f(t)e^{-jn\omega_1t}\mathrm dt\\ + &=\frac 12e^{j\varphi_n}\\ + &=\frac 12(a_n-jb_n) +\end{align*} +$$ + +**note** When $b_n=0$, $\varphi_n = a_n > 0\ ?\ 0:\pi$ + +In the last part, the negative frequency is introduced for the convenience of the signal analysis. Therefore the amplitude is reduced to half. + + +**FS for special functions** + +1. Even function $c_n=a_n, \varphi_n = 0, F_n=F_{-n}=\frac 12 a_n$ +2. Odd function $a_0=0, a_n=0, \varphi_n=-\frac{\pi}{2}, F_n=F_{-n}=-\frac{1}{2}jb_n$ +3. Half-wave Odd (odd harmonic) function, $f(t)=-f\left(t\pm \frac{T_1}2{}\right)$, contains only odd harmonics(both sine and cosine) +4. Finite term series + +### FS for typical periodic signals + +**Periodic square wave** + +$$ +f(t)=\frac{E\tau}{T_1}+\sum_{n=1}^{\infty}\frac{2E\tau}{T_1}\text{Sa}(\frac{n\omega_1\tau}{2}) +$$ + +1. Spectrum is discrete with frequency spacing $\omega_1 = \frac{2\pi}{T_1}$. When $T_1 \rightarrow \infty$, the spectrum will be continuous. +2. Amplitude: $\text{Sa}\left(\frac{n\pi\tau}{T_1}\right)$ or $\text{Sa} \left(\frac{n\omega_1\tau}{2}\right)$, cross zero when $\omega_1 = \frac{2m\pi}{\tau}$ +3. Non-zero FS coefficients of a aperiodic signal are infinite with most energy concentrated at low frequency components (within $\left(-\frac{2\pi}{\tau},\frac{2\pi}{\tau}\right)$). Thus we define the bandwith $B_{\omega} = \frac{2\pi}{\tau}$ + +**Periodic symmetric square wave** + +Since the spectrum crosses zero when $\omega_1 = \frac{2m\pi}{\tau}$, the even harmonic vanishes. Also the sine component vanishes. + +$$ +c_n = \frac{2E\tau}{T_1}\left|\text{Sa}\left(\frac{n\omega_1\tau}{2}\right)\right|\\ +f(t) = \frac{2E}{\pi}\left[\cos(\omega_1t) - \frac{1}3\cos(3\omega_1t) + \frac{1}{5}\cos(5\omega_1t)-...\right] +$$ + +**Periodic Serrated Pulse** + +$$ +f(t) = \sum_{n = 1}^\infty \frac{E}{n\pi}(-1)^{n+1}\sin (n\omega_1t) +$$ + +**Periodic Triangular Pulse** + +$$ +f(t)=\frac E2 + \frac{4E}{\pi^2}\sum_{n=1}^\infty\frac{1}{n^2}\sin^2\left(\frac{n\pi}{2}\right)\cos(n\omega_1t)\\=\frac E2 + \frac{4E}{\pi^2}\sum_{n=1}^\infty\frac{1}{(2n-1)^2}\cos((2n-1)\omega_1t) +$$ + +**consine of non-negative values** + +$$ +f(t) = \frac E\pi - \frac{2E}{\pi}\sum_{n=1}^\infty\frac{1}{n^2-1}\cos(\frac {n\pi}2)\cos(n\omega_1t) +$$ + +**cosine of absoulute values** + +$$ +f(t) = \frac{2E}{\pi} + \frac{4E}{\pi}\sum_{n=1}^\infty (-1)^{n+1}\frac{1}{4n^2-1}\cos(2n\omega_0t) +$$ + +其中$\omega_0$ = $2\omega_1$ + +### Fourier Transform + +The case where $T_1\rightarrow \infty$. Signal becomes aperiodic. + +Also, $\omega_1\rightarrow 0$ results in the continuous frequency axis. For square wave the magnitude $\frac{E\tau}{T_1}\rightarrow 0$. + +$$ +f(t) =\sum_{n=-\infty}^{\infty}F(n\omega_1)e^{jn\omega_1 t}\\ +F(n\omega_1) = \frac 1T_1\int_{-\frac {T_1}2}^{\frac {T_1}2}f(t)e^{-jn\omega_1t}\mathrm dt +$$ + +We use spectrum density to replace spectrum, making the magnitude dropping to zero remain its meaning. + +$$ +\frac{F(n\omega_1)}{\omega_1} = \frac{1}{2\pi}\int_{-\frac {T_1}2}^{\frac {T_1}2}f(t)e^{-jn\omega_1t}\mathrm dt\\ +F(\omega) = \lim_{\omega_1\rightarrow 0}\frac{2\pi F(n\omega_1)}{\omega_1}=\lim_{T_1\rightarrow \infty}\int_{-\frac {T_1}2}^{\frac {T_1}2}f(t)e^{-jn\omega_1t}\mathrm d t=\int_{-\infty}^\infty f(t)e^{-j\omega t}\mathrm d t\\ +f(t) = \sum_{n=-\infty}^{\infty}F(n\omega_1)\cdot \frac{1}{\omega_1}e^{jn\omega_1 t} \Delta(n\omega_1) = \frac{1}{2\pi}\int_{-\infty}^\infty F(\omega)e^{j\omega t}\mathrm d\omega +$$ + +$$ +F(\omega) = |F(\omega)|e^{j\varphi(\omega)} +$$ + +The fourier transfrom is continuous waveform, where every frequency has no energy but energy density, used to analyse aperiodic function. + +Sufficient condition, but not necessary. + +$$ +\int_{-\infty}^\infty |f(t)|\mathrm dt<\infty +$$ + +### FT for typical aperiodic signals + +**Rectangular pulses** + +$$ +F(\omega) = \int_{-\tau/2}^{\tau/2} Ee^{-j\omega t}\mathrm dt = E\tau \text{Sa}\left(\frac{\omega \tau}{2}\right) +$$ + +**Raised Cosine Signal** + +$$ +f(t) = \frac{E}{2}(1+\cos\frac{\pi t}{\tau})(u(t+\tau) - u(t - \tau))\\ +F(\omega) = \int_{-\tau}^{\tau}(1+\cos\frac{\pi t}{\tau})\mathrm dt = \frac{E\tau}{1 - \left(\frac{\omega \tau}{\pi}\right)^2}\text{Sa}({\omega \tau}) +$$ + +More compacted than square signal($|F(\omega)|\propto \frac 1{\omega^3}$). An explanation is that the raised cosine has no discontinuities. + +Generally: + +1. $f(t)$ has discontinuities, $|F(\omega)|\propto \frac 1{\omega}$ +2. $\frac{d}{dt}f(t)$ has discontinuities, $|F(\omega)|\propto \frac 1{\omega^2}$ +3. $\frac{d^2}{dt^2}f(t)$ has discontinuities, $|F(\omega)|\propto \frac 1{\omega^3}$ + +The **width** $\tau$ of the raised cosine signal is defined at $\frac E2$ rather than at the bottom, making it easy to compare with + the rectangular pulse of same width. The first zeros of the + frequency spectrum are identical. + + +raised consine is energy-concentrative and has been widely used in digital communications. + +**Single-sided exponential singal** + +$$ +f(t) = e^{-at}u(t)\\ +F(\omega) = \frac{1}{a+j\omega} +$$ + +**Two-sided, anti-symmetric exponential signal** + +$$ +f(t) = -e^{at}u(-t) + e^{-at}u(t)\\ +F(\omega) = \frac{-2j\omega}{a^2+\omega^2} +$$ + +**Sign function** + +$$ +\text{sgn}(t) = u(t) - u(-t)\\ +F(\omega) = \lim_{a\rightarrow 0}\frac{-2j\omega}{a^2+\omega^2}= \frac{2}{j\omega} +$$ + +**Gaussian singal** + +$$ +f(t) = Ee^{-\left(\frac{t}{\tau}\right)^2}\\ +F(\omega) = \sqrt \pi E\tau e^{-\left(\frac{\omega\tau}{2}\right)^2} +$$ + +**Sinc Function** + +$$ +f(t) = \frac{E}{\pi}\frac{\sin(\omega_c t)}{t}\\ +F(\omega) = E(u(\omega - \omega_c ) + u(\omega + \omega_c ))\\ +$$ + + +### FT on impulse and step functions + +$$ +\mathcal F[\delta(t)] = 1\\ +\mathcal F[1] = 2\pi \delta(\omega) +$$ + +The spectrum of impulse function covers the entire frequency range. The interferences caused by a variety of electric sparks always cover the full frequency range. + +$$ +\mathcal F[\delta^\prime (t)]= j\omega\\ +\mathcal F[\delta^{(n)}(t)] = (j\omega)^n +$$ + +$$ +\mathcal F[u(t)] = \pi \delta(\omega) + \frac{1}{j\omega} +$$ + +Due to the DC component in u(t), an impulse exists. + +### Properties of FT + +**Symmetry** $\mathcal F[F(t)]= 2\pi f(-\omega)$ , if $f(t)$ is a even function, $\mathcal F[F(t)]= 2\pi f(\omega)$ + +**Linearity** $\mathcal{F}[\Sigma_{i=1}^{n}a_if_i(t)] = \Sigma_{i=1}^{n}a_iF_i(\omega)$ + +**Odd-Even, Imaginary-Real** $f(t) = f_e(t)+f_o(t)$, then + +$$ +\begin{align*} + F(\omega) &= \int_{-\infty}^\infty f(t)\cos \omega t \mathrm dt -j\int_{-\infty}^\infty f(t)\sin \omega t \mathrm dt\\ + &=R(\omega)+jX(\omega)\\ + &=\int_{-\infty}^\infty f_e(t)\cos \omega t \mathrm dt -j\int_{-\infty}^\infty f_o(t)\sin \omega t \mathrm dt\\ +\end{align*}. +$$ + +$R(\omega)$ is an even function of $\omega$, $X(\omega)$ is an odd function of $\omega$. + +$|F(\omega) = \sqrt{R^2(\omega)+F^2(\omega)}|$ is even function. + +$\varphi(\omega) = \tg^{-1}\frac{R(\omega)}{X(\omega)}$ + +if $f(t)$ is real and even, then $f(t)=f_e(t), F(\omega)=R(\omega)$, the phase shift is $0$ or $\pi$. + +if $f(t)$ is real and odd, $f(t) = f_o(t)$, then $F(\omega)=jX(\omega)$, $F(\omega)$ has only imaginary part and is odd, the phase shift is $\pm \frac{\pi}{2}$ + +**Scaling** $\mathcal{F}[f(at)]=\frac 1{|a|}F\left(\frac{\omega}a\right)$ Expansion in TD results in Compression in FD. + +**Time Shifting** $\mathcal{F}[f(t\pm t_0)] = F(\omega)e^{\pm j\omega t_0}$ + +**Frequency Shifting** $\mathcal F[f(t)e^{\pm j\omega_0t}] = F(\omega\mp\omega_0)$ + +**Differentiation property**$\mathcal F\left[\frac{\mathrm d}{\mathrm dt}f(t)\right] = j\omega F(\omega)$ + +$\mathcal F\left[\frac{\mathrm d^n}{\mathrm dt^n}f(t)\right] = (j\omega)^n F(\omega)$ + +$\mathcal F\left[\frac{\mathrm d^n}{\mathrm d\omega^n}F(\omega)\right] = (-jt)^nf(t)$ + + +**Integration Property** $\mathcal{F}\left[\int_{-\infty}^t f(\tau)\mathrm{d} \tau\right] = \frac{F(\omega)}{j\omega} + \pi F(0)\delta(\omega)$ + +### Convolution theorem + +$$ +\mathcal F[f_1(t)* f_2(t)] = F_1(\omega)F_2(\omega)\\ +\mathcal F[f_1(t)\cdot f_2(t)] = \frac 1{2\pi} F_1(\omega) * F_2(\omega) +$$ + +### FT for Periodic Signals + +$$ +\mathcal F[\cos (\omega_0 t)] = \pi [\delta(\omega + \omega_0) + \delta(\omega - \omega_0)]\\ +\mathcal{F} [\sin (\omega_0 t)] = j\pi [\delta(\omega+\omega_0) + \delta(\omega - \omega_0)] +$$ + +FT for periodic of $T_1$ & $\omega_1=2\pi/T_1$ + +$$ +\mathcal F[f(t)] = 2\pi\sum_{n=-\infty}^{+\infty} F_n\delta(\omega - n\omega_1)\\ +F_n = \frac 1{T_1}\int_{-T_1/2}^{T_1/2}f(t)e^{-jn\omega_1 t}\mathrm dt = \frac{1}{T_1}F_0(\omega)\vert_{\omega =n\omega_1} +$$ + +Where $F_0(\omega)$ is the FT considering waveform of $f(t)$ only in $|t|\le T_1/2$. + +example: + +$$ +f(t) = \sum_{n=0}^{\infty}\delta(t-nT_1), F_n=\frac{1}{T_1}\\ +F(\omega) = \frac{2\pi}{T_1}\sum_{n=0}^{\infty}\delta(\omega - n\omega_1)=\omega_1\sum_{n=0}^{\infty}\delta(\omega - n\omega_1) +$$ + +$$ +F_0(ω) \text{ determines the profile of } F(ω)\\ +T_1\text{ determines the density of the impulses +}\\ +T_1↑, ω_1↓\text{, intensity of harmonics}↓\\ +T_1↓,ω_1↑\text{, intensity of harmonics}↑\\ +$$ + +![](../images/ss/lec7_1.jpg) + +In the same way: + +![](../images/ss/lec7_2.jpg) + +### FT for periodically sampled signals + +$$ +F(\omega) = \mathcal F[f(t)]\\ +P(\omega) = \mathcal F[p(t)]\\ +f_s(t) = f(t)p(t)\\ +F_s(\omega) =\frac{1}{2\pi} F(\omega) * P(\omega) +$$ + +Then, + +$$ +P(\omega) = 2\pi \sum_{n = -\infty}^{+\infty} P_n\delta(\omega - \omega_s)\\ +F(\omega) * P(\omega) = 2\pi \sum_{n = -\infty}^{+\infty} P_nF(\omega - n\omega_s)\\ +F_s(\omega) = \sum_{n = -\infty}^{+\infty} P_nF(\omega - n\omega_s) +$$ + +![](../images/ss/lec7_3.jpg) + +For the frequency-domain sampling: + +$$ +F_1(\omega) = F(\omega)P(\omega)\\ +P(\omega) = \sum_{n=-\infty}^{+\infty} \delta(\omega - n\omega_1)\\ +f_1(t) = f(t) * \frac{1}{\omega_1}\sum_{n=-\infty}^{+\infty} \delta(t - nT_1) = \frac{1}{\omega_1}\sum_{n=-\infty}^{\infty} f(t-nT_1) +$$ + +**The Sampling Theorem** + +$$ +\omega_s \ge 2\omega_m +$$ + +A band-limited signal whose spectrum is strictly within $[0, f_m]$ could be uniquely determined by the samples on itself, if and only if the sampling interval $T_s \le 1/(2f_m)$. + +$T_s = \frac{1}{2f_m}$ is called the **Nyquist interval**. + +$2f_m$ is called the **Nyquist frequency**. + +对于单频信号,奈奎斯特频率的采样可能会出现问题。例如正弦信号,每次采样都采在零点上,那就没法复现信号。单频信号没法描述带宽。 + +A FD verison: + +![](../images/ss/lec7_4.jpg) + + + +## L Transform + +### Unilateral L-transform + +$$ +F(s) = \int^{\infty}_{0}f(t)e^{-st}\mathrm dt, s=\sigma+j\omega\\ +f(t)=\frac{1}{2\pi j}\int_{\sigma-j\infty}^{\sigma+j\infty}F(s)e^{st}\mathrm ds +$$ + +$F(s) = \mathcal{L}[f(t)]$ is called image function, $f(t) = \mathcal{L}^{-1}[F(s)]$ is called primitive function. + +assuming that $f(t)$ is causal and always 0 if $t<0$. + +$$ +\mathcal L \left[\frac{\mathrm df(t)}{\mathrm dt}\right] = -f(0) + sF(s) +$$ + +The initial state is automatically included in differential equation. + +We define the **unilateral** L-Transform as: + +$$ +F(s) = \int_{0_-}^{\infty}f(t)e^{-st}\mathrm dt\\ +\mathcal L \left[\frac{\mathrm df(t)}{\mathrm dt}\right] = -f(0_-) + sF(s) +$$ + +Conditions for L-Transform: + +1. Limited discontinuities +2. Exponential order + +The strong attenuation factor can make the function convergent. + +Region of Convergence (ROC) + +Axis of convergence + +Coordinate of convergence $\sigma_0$ + +### Comman LT Pairs + +$$ +\begin{align*} +f(t)&\Rightarrow F(s)\\ +\delta(t) &\Rightarrow 1\\ +u(t) &\Rightarrow \frac 1s\\ +e^{-at} &\Rightarrow \frac{1}{s+a}\\ +t^n & \Rightarrow \frac{n!}{s^{n+1}}\\ +\sin (\omega t)&\Rightarrow \frac{\omega}{s^2 + \omega^2}\\ +\cos (\omega t)&\Rightarrow \frac{s}{s^2+\omega^2}\\ +\end{align*} +$$ + +### Properties of LT + +**Linarity** + +$$ +\mathcal L [k_1f_1(t) + k_2f_2(t)] = k_1F_1(s) + k_2F_2(s)\\ +$$ + +**Differentiation** + +$$ +\mathcal L \left[\frac{\mathrm d f(t)}{\mathrm d t}\right] = sF(s) - f(0_-) +$$ + +**Intergration** + +$$ +\mathcal L\left[\int_{-\infty}^t f(\tau)\mathcal d\tau\right]=\frac{F(s)}{s} + \frac{f^{(-1)}(0)}{s} +$$ + +**Time Shifting** + +$$ +\mathcal L\left[f(t-t_0)u(t-t_0)\right] = e^{-st_0}F(s) +$$ + +Use $u(t-t_0)$ to avoid nagative part of $f(t)$ emerges. + +**Frequency Shifting** + +$$ +\mathcal L[f(t)e^{-at}] = F(s+a) +$$ + +**Scaling** + +$$ +\mathcal L[f(at)] = \frac 1a F\left(\frac{s}{a}\right) +$$ + +**s-Domain Differentiation** + +$$ +\frac{\mathrm d}{\mathrm ds}\mathcal L[f(t)] = \mathcal L[-tf(t)] +$$ + +**s-Domain Differentiation** + +$$ +\int_s^\infty F(s) = \mathcal{L}\left[\frac{f(t)}{t}\right] +$$ + +**Initial value** + +$$ +f(0_+) = \lim_{s\rightarrow\infty}sF(s) +$$ + +**Final value** + +$$ +\lim_{t\rightarrow\infty} f(t) = \lim_{s\rightarrow0} sF(s) +$$ + +Generalized limit: $\lim_{t\rightarrow\infty} \sin(\omega t)=0$ + +**Convolution** + +$$ +\mathcal L[f_1(t)*f_2(t)] = F_1(s)F_2(s) +$$ + +### Applications + +**Differential Equations** + +$$ + F(s) = \frac{A(s)}{B(s)} = \frac{a_ns^n + a_{n-1}s^{n-1} + \cdots + a_1s + a_0}{b_ms^m + b_{m-1}s^{m-1} + \cdots + b_1s + b_0} % The division of two polynomials +$$ + +(assume that $n 0$, $F(\omega)$ does not exist +* $\sigma_0 = 0$, impulse appears in $F(\omega)$ +* $\sigma_0 < 0$, $F(\omega)$ exists, $F(\omega) = F(s)|_{s=j\omega}$ + +![](../images/ss/lec11_2.jpg) +(The LT above is unilateral LT.) + + +![](../images/ss/lec11_3.jpg) + +### Extra Attention + +$1 + e^{-s}$ also has zero(many!). Note that if it is on the denominator. + +## FT in Telecom. Systems + +System discussed in this chapter are strictly stable: + +$$ +\mathcal{F}[f(t)] = F(s)|_{s=j\omega} +$$ + +Because even for critical stable system, FT is not the same as LT(containing $\delta$), there will be ambiguity between $H(j\omega)$ and $H(s)|_{s=j\omega}$. + +For every freq. component, it is reshaped in its phase and amplitude by the system function when passing through the system, related with its frequency. Thus the system can distort the original signal. + +**Distortion** + +2 types of distortion: + +* Non-linear distortion (new frequency components) +* Linear distortion (without new frequency components), just the amplitude and/or phase distortion. + + **Distortionless transmission** + +$$ +e(t)\rightarrow ke(t - t_0) +$$ + +$$ +R(j\omega) = \int_{-\infty}^\infty ke(t -t_0)e^{-j\omega t}\mathrm dt=ke^{-j\omega t_0}\int_{-\infty}^\infty e(x)e^{-j\omega x}\mathrm dx=ke^{-j\omega t_0} E(j\omega) +$$ + +So, $H(j\omega) = ke^{-j\omega t_0}$, $h(t)=K\delta(t - t_0)$. + +The Amplitude is frequency independent, $BW\rightarrow \infty$. + +Phase response is linear at negative slope. + +The impulse response of a distortionless linear system is + also an impulse. + +The physical scenario: group delay. + +$$ +\tau = -\frac{\mathrm d\varphi (\omega)}{\mathrm d\omega} +$$ + +Condition for phase distortionless property: the group delay remains a constant. + +### Filter + +**Ideal Low pass (LP) Filter** + +$$ +H(j\omega) = \begin{cases} + 1 \cdot e^{-j\omega t_0}, &|\omega|< \omega_c,\\ + 0, &|\omega|> \omega_c. +\end{cases} +$$ + +![](../images/ss/lec12_1.jpg) + +**The Impulse response of Ideal LP** + +![](../images/ss/lec12_2.jpg) + +* Severe distortion. $BW_{\delta(t)}\rightarrow \infty$, but $BW_{\text{Lowpass}}=\omega_c$, the higier frequency is eliminated. +* Non-causal. When $t\lt 0$, $h(t)\ne 0$. + +**Unit-step response of Ideal LP** + +![](../images/ss/lec12_3.jpg) + +![](../images/ss/lec12_4.jpg) + +![](../images/ss/lec12_5.jpg) + +The response is similar to the input if $\frac{1}{2}=\frac{\pi}{\omega_c}\llless \tau$. + +**Gibbs phenomenon**: 9% overshoot at discontinuity. Use other window functions can eliminate this, e.g. raised-cosine window. + +### Modulation and demodulation + +Means of modulation: + +**Spectrum shifting** + +$f(t) = g(t)\cos(\omega_0t)$, $F(\omega) =\frac{1}{2\pi} G(\omega) * \pi[\delta(\omega - \omega_0) + \delta (\omega + \omega_0)] = \frac{1}{2}[G(\omega + \omega_0) + G(\omega - \omega_0)]$. + +![](../images/ss/lec12_6.jpg) + +Demodulation: + +**coherent demodulation** + +$g_0(t)=[g(t)\cos(\omega_0 t)]\cos(\omega_0t) = \frac{1}{2}g(t) + \frac{1}{2}g(t)\cos2\omega_0t$ + +![](../images/ss/lec12_7.jpg) + +**Envelope Detection** + +![](../images/ss/lec12_8.jpg) + +### Applications of BPF + +**Window Function** +(Page 304) +$$ +h_a(t) = \frac{\sqrt a \sin\left(\frac{\pi t}{a}\right)\cos \left(\frac{3\pi t}{a}\right)}{\sqrt{ \pi} \pi t}\\ +H_a(\omega) = \begin{cases} + \frac{1}{2}\sqrt{\frac{a}{\pi}}, \text{if } \frac{2\pi}{a}\le |\omega| \le \frac{4\pi}{a},\\ + 0, \text{otherwise}. +\end{cases} +$$ + +![](../images/ss/lec13_1.jpg) + +### Recover Continuous Time signal from its Samples + +**Analysis on signal after band-pass filter** + +Page 301 + +**Sampling with impulse func.** + +FD analysis: + +Sampled signal(By impulse function): + +$$ +F_s(\omega) = \frac{1}{T_s}\sum_{n=-\infty}^\infty F(\omega - n\omega_s) +$$ + +Ideal LP Filter: + +$$ +H(j\omega) = \begin{cases} + T_s, &|\omega|< \omega_c,\\ + 0, &|\omega|> \omega_c. +\end{cases} +$$ + +Recovered signal: + +$$ +F(\omega) = F_s(\omega) \cdot H(\omega) +$$ + +TD analysis: + +Sampled signal: + +$$ +f_s(t) = \sum_{n=-\infty}^\infty f(nT_s)\delta(t - nT_s) +$$ + +Ideal LP Filter: + +$$ +h(t) = T_s\frac{\omega_c}\pi \text{Sa}(\omega_c t) +$$ + +Recovered signal: + +$$ +f(t) = f_s(t) * h(t) = T_s\frac{\omega_c}\pi \sum_{n=-\infty}^\infty f(nT_s) \text{Sa}(\omega_c (t-nT_s)) +$$ + +![](../images/ss/lec14_1.jpg) + +![](../images/ss/lec14_2.jpg) + +**Sampling with a zero-order hold** + +![](../images/ss/lec14_3.jpg) + +$$ +h_0(t) = u(t) - u(t - T_s)\\ +f_{s0}(t) = f_s(t)* h_0(t) +$$ + +$$ +\begin{align*} +&\mathcal F\{f_{s0}(t)\} \\&=\mathcal F\{f_s(t)\} \cdot \mathcal F\{h_0(t)\} \\ &=F_s(\omega) \cdot H_0(\omega)\\ +&=\sum_{-\infty}^{\infty}F(\omega - n\omega_s) \cdot \text{Sa}(\frac{\omega_c T_s}{2})e^{-j\frac{\omega T_s}{2}}\\ +\end{align*} +$$ + +LP Filter for compensation + +$$ +H_{0r}(\omega) = \begin{cases} + \frac{1}{\text{Sa}(\frac{\omega T_s}{2})}e^{j\omega T_s/2}, &|\omega| \le \omega_s/2,\\ + 0, &|\omega|> \omega_s/2. +\end{cases} +$$ + +Linear phase response is OK! No needed for delay compensation. + +**1st-order hold Sampling** + +![](../images/ss/lec14_4.jpg) + +### Mulitplexing FDM and TDM + +Transmit mulitple singals over a single channel concurrently. + +Frequency Division Multiplexing (FDM) - OFDM (Orthogonal FDM) + +Time Division Multiplexing (TDM)-sharing slot, statistical multiplexing + +Code Division Multiplexing (CDM)- Code division, logical multiplexing + +Wavelength Division Multiplexing (WDM)- Optical carrier + +![](../images/ss/lec14_5.jpg) + +![](../images/ss/lec14_6.jpg) + +![](../images/ss/lec14_7.jpg) + +## Vector Analysis of Signals + +### Vector Space + +![](../images/ss/lec15_1.jpg) + +![](../images/ss/lec15_2.jpg) + +![](../images/ss/lec15_3.jpg) + +![](../images/ss/lec15_4.jpg) + +![](../images/ss/lec15_5.jpg) + +### Objective for singal decomposition + +$$ +r(t) = H[e(t)] = H\left[\sum_{i=0}^ne_i(t)\right] = \sum_{i=0}^nH[e_i(t)] +$$ + +### Basics + +**Orthogonal Vector** + +![](../images/ss/lec15_6.jpg) + +**Orthogonal Function** + +Represend $f_1(t)$ in terms of $f_2(t)$(both real), for $t_10$), $z(n) = x(n +m)$ left shift + +**Reflection** $z(n) = x(-n)$ + +**Difference** $\Delta x(n) = x(n + 1) - x(n)$ Forawrd difference, + +$\nabla x(n) = x(n) - x(n - 1)$ Backward difference + +$\nabla^mx(n) = \nabla(\nabla^{m-1}x(n))$ + +**Summation** $z(n) = \sum_{k = -\infty}^{n}x(k)$ + +**Scaling** $z(n) = z(2n)$ squeeze, + +$z(n) = x(n/2)$, extend + +### Typical sequences + +![](../images/ss/lec16_2.jpg) + +![](../images/ss/lec16_3.jpg) + +Relations of several singal waveforms + +$$ +u(n) = \sum_{k = 0}^{\infty}\delta(n - k)\\ +\delta(n) = u(n) - u(n - 1)\\ +R_N(n) = u(n) - u(n - N)\\ +$$ + +### Signal Decomposition + +$$ +x(n) = \sum_{m = -\infty}^{\infty}x_m\delta(n - m)\\ +$$ + +$$ +\delta(n - m) = \begin{cases} +1, & n = m\\ +0, & n \neq m +\end{cases} +$$ + +### Difference equations + +![](../images/ss/lec16_4.jpg) + +Numerical solution of difference equations + +General form of difference equation: + +$$ +\sum_{k = 0}^N a_ky(n - k) = \sum_{r = 0}^M b_ry(n - r)\\ +$$ + +**Methods:** +- Recursive method +- - Intuitive, difficult to formulate the closed-form solutions +- Time-domain classical method +- - Obtain homogeneous and particular solutions and using the boundary condition to determine the coefficients. +- The sum of the zero-input and zero-state responses +- - Convolution (next class) +- Z-transform (Chapter 8) +- State variable method (Chapter 11) + +**Homogeneous Solution** + +$$ +\sum_{k = 0}^N a_ky(n - k) = 0\\ +$$ + +The **characteristic root** $\alpha_k$ satisfies: + +$$ +a_0\alpha^N + a_1\alpha^{N-1} + \cdots + a_N = 0\\ +$$ + +The homogeneous solution is: + +$$ +y(n) = c_1\alpha_1^n + c_2\alpha_2^n + \cdots + c_N\alpha_N^n\\ +$$ + +**Particular Solutions**: + +![](../images/ss/lec16_.jpg) + +**General steps** + +1. Obtain homogeneous solutions from characteristic equation $c_1\alpha_1^n + c_2\alpha_2^n + \cdots + c_N\alpha_N^n$ +2. Determine the form of the particular solution $D(n)$ +3. The complete solution $c_1\alpha_1^n + c_2\alpha_2^n + \cdots + c_N\alpha_N^n + D(n)$ +4. Introduce the boundary condition and set up equations +$$ +y(0) = C_1 +C_2 + \cdots + C_N + D(0)\\ +y(1) = C_1\alpha_1 +C_2\alpha_2 + \cdots + C_N\alpha_N + D(1)\\ +\vdots\\ +y(N - 1) = C_1\alpha_1^{N - 1} + C_2\alpha_2^{N - 1} + \cdots + C_N\alpha_N^{N - 1} + D(N - 1)\\ +\Rightarrow\\ +Y(k) - D(k) = VC\\ +C = V^{-1}(Y(k) - D(k))\\ +$$ + +### Zero-input and zero-state responses + +$$ +y(k) = y_{zi}(k) + y_{zs}(k) +$$ + +**Zero-Input Response** +$D(k) = 0 \Rightarrow C_{zi} = V^{-1}Y_{zi}(k)$ + +**Zero-State Response** + +$$ +\begin{align*} + C_{zs} &= V^{-1}[Y_{zs}(k) - D(k)]\\ +C_{zs} &= V^{-1}[Y(k) - Y_{zi}(k) - D(k)]\\ +C &= C_{zi} + C_{zs}\\ +\end{align*} +$$ + +**Natural Response** $\sum_{k = 1}^NC_k\alpha_k^n$ + +**Forced Response** $D(n)$ + +Characteristics of the boundary condition for difference equations + +N-th order difference equation should have N independent boundary conditions. + +Compared with continuous systems, there are no big differences between $0_+$ and $0_-$ in discrete systems. + +$y(-1), y(-2), \dots, y(-N)$ are the system memory (storage) before the excitation is added: $0_-$ + +Derive (together with the excitation) $y(0), y(1), …, y(N-1): 0_+$ + +Using Z-transform can avoid mistakes-similar to the Laplace transform in continuous systems. + +### Impulse response of DT systems + +Similar to CT System, h(n) reflects system’s property + +**Causality** $h(n) = h(n) u(n)$ (unlateral, $n\lt 0$ no response) + +**Stability** $\sum_{n=-\infty}^\infty |h(n)| \lt \infty$ (absolutely summable) + + NOTE: critical stability can be considered as either stable or unstable, e.g., system whose impulse response is a sine sequence + + +Not all practical discrete systems are necessarily causal: + +* Variable is not time, like image processing +* Variable is time, but data has been recorded and processed, like voice processing, meteorology, stock systems. + +Example: Smooth windowing + +$$ +y(n) = \frac{1}{2M+1}\sum_{k=-M}^M x(n-k) +$$ + +Discrete non-causal system + +### Convolution Sum + +$$ +y(n) = \sum_{m = -\infty}^\infty x(m)h(n - m) = h(n) * x(n) +$$ + +Similar to CT system, also satisfies both distributive and associative laws + +Calculation of convolution: +Four steps: reflection, shift, multiplication and summation. + +Calculation of correlation: +Cross- & auto-correlation: shift, multiplication & summation. + +Example: + +$$ +x(n) = u(n) - u(n - N)\\ +h(n) = a^nu(n)\\ +y(n) = x(n) * h(n) +$$ + +$$ +y(n) = \sum_{m = -\infty}^\infty [u(m) - u(m - N)]a^{n - m}u(n - m) +$$ + +if $n < 0$, then $y(n) = 0$ + +if $0 \le n \lt N - 1$, $y(n) = \sum_{m = 0}^na^{n-m} = \frac{1}{1 - a}[1 - a^{n+1}]$ + +if $n \ge N - 1$, $y(n) = \frac{1 - a^{-N}}{1 - a^{-1}}a^n$ + +**Deconvolution** + +**Signal retrieval** y(n) and h(n) are known, how to derive x(n)? + +*Measurement equipment (linear system), like sensor for measuring blood pressure* + +**System identification** y(n) and x(n) are known, how to derive h(n)? + +*Earthquake signal, like geological survey, oil exploration, etc.* + +$$ +\begin{bmatrix*} + y(0)\\ + y(1)\\ + y(2)\\ + \vdots\\ + y(n) +\end{bmatrix*} = +\begin{bmatrix*} + h(0) & 0 & 0 & \dotsb & 0\\ + h(1) & h(0) & 0 & \dotsb & 0\\ + h(2) & h(1) & h(0) & \dotsb & 0\\ + \vdots & \vdots & \vdots & \ddots & \vdots\\ + h(n) & h(n-1) & h(n-2) & \dotsb & h(0)\\ +\end{bmatrix*}\begin{bmatrix*} + x(0)\\ + x(1)\\ + x(2)\\ + \vdots\\ + x(n) +\end{bmatrix*} +$$ + +Thus, + +$$ +x(n) = \left[y(n) - \sum_{m = 0}^{n-1} x(m) h(n - m)\right]/h(0)\\ +h(n) = \left[y(n) - \sum_{m = 0}^{n-1} h(m) x(n - m)\right]/x(0) +$$ + +### Important Concepts + +![](../images/ss/lec17_1.jpg) + +1. Symbol rate : clock period is $T$, signal symbol rate is $f = 1/T$. +2. Information rate: information rate equals to symbol rate for binary encoding, otherwise, equal to multiplication between symbol rate and number of information bits per symbol. +3. Signal bandwidth: the first zero of non-return-to-zero (NRZ) signal’s spectrum is $1/T$, so the signal bandwidth is $B=1/T =f$. + +> 这句话是在介绍非归零码(Non-Return-to-Zero,简称NRZ)信号的带宽计算方式。 +> +> 在信号处理和通信中,信号的频谱表示了信号在不同频率上的能量分布。对于一个NRZ信号,它的频谱图中第一个零点(也就是在零周围出现的第一个极小值点)出现在频率为$1/T$处,其中$T$是NRZ信号中一个脉冲的时间长度。这是因为NRZ信号的频谱是由一个周期为$T$的方波产生的,其频率成分只包含正弦函数的奇次谐波。其中,最低的一个谐波频率是$f=\frac{1}{T}$,对应的是频率为$f$的正弦波。所以,NRZ信号的带宽$B$就被定义为$f=1/T$。 +> +> 简而言之,NRZ信号的带宽是由脉冲的时间长度决定的,具体来说,带宽等于脉冲频率的一半,即带宽等于$f=1/T$。 + +NOTE: + +When NRZ code is used, signal bandwidth = symbol rate + +When return-to-zero (RZ) code is used, signal bandwidth > symbol rate + +Using NRZ code can save bandwidth yet high frequency components of the rectangular signal will suffer from the severe inter-symbol interference (ISI). So the raised cosine or Sa function is preferred. +> ChatGPT: +> +> 归零码和非归零码都是数字通信中常用的编码方式。 +> +> 归零码(Return-to-Zero,简称RZ)是一种二进制码,其中一个信号所代表的位是由一个脉冲表示的。发送二进制“1”时,脉冲电平为高电平,发送二进制“0”时,脉冲电平为低电平。在归零码中,一个信号位所代表的脉冲之后,信号在下一时刻会回到零电平。由于归零码中每个脉冲结束时信号回到零电平,因此这种编码方式具有稳定可靠的特点,但是传输的带宽相对较大。 +> +> 非归零码(Non-Return-to-Zero,简称NRZ)的编码方式与归零码不同之处在于,在NRZ信号中,一个信号所代表的位是由一个固定电平表示的。当信号所代表的位是二进制“1”时,固定电平为高电平;当信号所代表的位是二进制“0”时,固定电平为低电平。这种编码方式的好处是带宽更小,但是却存在着在多个二进制“1”连续发送时,出现误解的情况。 +> +> 综上所述,归零码是二进制码中脉冲与幅度的双重编码,不易产生传输误码,但其对于通信带宽需求较大;而非归零码不需要对脉冲进行编码,在带宽方面具有一定的优势,但长时间连续发送相同信息时会产生误解。 + +### Z-Transform + +Similar to the L-Tranform. + +**Definition** + +$$ +X(z) = Z(x(n)) = \sum_{n = -\infty}^{\infty} x(n) z^{-n} +$$ + +**Z-T of Typical Series** + +$z \in \Complex$ + +$$ +\delta(n) \rightarrow 1\\ +u(n) \rightarrow \frac{1}{1-z^{-1}}(|z| \gt 1)\\ +nu(n) \rightarrow \frac{z^{-1}}{(1-z^{-1})^2}(|z| \gt 1)\\ +a^n u(n) \rightarrow \frac{1}{1-az^{-1}}(|z| \gt |a|)\\ +\cos(\omega_0 n) u(n) \rightarrow \frac{1-z^{-1}\cos(\omega_0)}{1-2z^{-1}\cos(\omega_0) + z^{-2}}\\ +\sin(\omega_0 n) u(n) \rightarrow \frac{z^{-1}\sin(\omega_0)}{1-2z^{-1}\cos(\omega_0) + z^{-2}}\\ +$$ + +**The Region of Convergence** + +![](../images/ss/lec18_1.jpg) + +**Inverse Z-Transform** + +$$ +x(n) = \frac{1}{2\pi j} \oint_C X(z) z^{n-1} dz +$$ + +**Method** + +**Contour Integration(residue method)** + +Right-sided sequence + +$$ +x(n) = \sum_{k = 1}^{N} Res\{X(z)z^{n-1}\}|_{z = z_k} +$$ + +Left-sided sequence + +$$ +x(n) = - \sum_{k = 1}^{N} Res\{X(z)z^{n-1}\}|_{z = z_k} +$$ + +**Power series expansion(Long division)** + +![](../images/ss/lec18_2.jpg) + +If it is right sided, + +$$ +X(z) = \sum_{n = 0}^\infty x(n)z^{-n} +$$ + +If it is left sided, + +$$ +X(z) = \sum_{n = -\infty}^{-1}x(n)z^{-n} +$$ + +**Partial Fraction Expansion** + +$$ +\frac{z}{z - a} \lrarr \begin{cases} + a^nu(n), &|z|\gt |a|\\ + -a^nu(-n-1), &|z|\lt |a| +\end{cases} +$$ + +![](../images/ss/lec18_3.jpg) + + +![](../images/ss/lec18_34jpg.jpg) + +![](../images/ss/lec18_6.jpg) + +**Properties of Z-T** + +**Linearity** + +Addition and homogeneity + +ROC may change! + +i.e. poles are cancelled when added: ROC will enlarge or and shrink. + +**Time shifting** + +(a) bilateral: If $\mathcal Z[x(n)] = X(z), R_{X_1} < |z| < R_{X_2}$, then $\mathcal{Z}[x(n-m)] = z^{-m}X(z), R_{X_1} < |z| < R_{X_2}$. + +(b) unilateral: if $\mathcal{Z}[x(n)] = X(z), R_{X_1} < |z|$, then $\mathcal{Z}[x(n-m)] = z^{-m}[X(z) + \sum_{k = -m}^{-1}x(k)z^{-k}], R_{X_1}\lt |z|$, and $\mathcal{Z}[x(n+m)] = z^{m}[X(z) - \sum_{k = 0}^{m-1}x(k)z^{-k}], R_{X_1}\lt |z|$ + +For casual sequence, $n < 0, x(n) = 0$, the unilateral is also $\mathcal{Z}[x(n-m)] = z^{-m}X(z)$. + +The reason is that the unilateral z transform doesn't contain the $n<0$ parts of sequence, but after shifting, sometimes must be counted(right shift), sometimes must be discarded(left shift). + +**Linear weighting on sequence(Z domain differentiation)** + +$$ +\mathcal{Z}[x(n)] = X(z) \Rightarrow nx(n)\lrarr -z\frac{dX(z)}{dz} +$$ + +Generalization: + +$$ +n^mx(n)\lrarr \bigg[-z\frac{d}{dz}\bigg]^m X(z) +$$ + +**Geometric progression(Z-domain scaling)** + +$$ +a^n(x^n) \lrarr X(\frac{z}{a})\\ +(R_{x1} \lt \bigg|\frac{z}{a}\bigg| \le R_{x2}) +$$ + +$$ +a^{-n}x(n) \lrarr X(az)\\ +(-1)^nx(n) \lrarr X(-z) +$$ + +**Initial-value theorem** + +$$ +x(0) = \lim_{z \rightarrow \infty }X(z) +$$ + +**Final-value theorem** + +$$ +\lim_{n \rightarrow \infty } x(n) = \lim_{z \rightarrow 1}[(z-1)X(z)] +$$ + +condition: when $n \rightarrow \infty$, $x(n)$ converge + +Thus, the poles of $X(z)$ are inside the unit circle, the radius of ROC is less than 1. + +For $a^nu(n), |a| \lt 1$, the final value is 0. + +Or, if the pole is on the unit circle, it should be 1, and is of the 1st order. + +$u(n)$'s final value is 1. + +![](../images/ss/lec19_1jpg.jpg) + +**Time-domain convolution theorem** + +If $\mathcal{Z}{x(n)} = X(z), (R_{x1} \lt |z| \lt R_{x2}), \mathcal{Z}{h(n)} = H(z), (R_{h1} \lt |z| \lt R_{h2})$ + +$$ +\mathcal{Z}[x(n) * h(n)] = X(z)H(z)\\ +\max(R_{x1}, R_{h1}) \lt |z| \lt \min(R_{x2}, R_{h2}) +$$ + +If poles are cancelled in multiplication, ROC is enlarged. + +Conclusion: (Z Transform) convolution in time-domain is equivalent to multiplication (of Z Transform) in Z-domain. + +**Z domain convolution theorem** + +$$ +\mathcal{Z}[x(n)h(n)] = \frac{1}{2\pi j} \oint_C X(\frac{z}{v})H(v)v^{-1}dv +$$ + +or + +$$ +\mathcal{Z}[x(n)h(n)] = \frac{1}{2\pi j} \oint_C X(v)H(\frac{z}{v})v^{-1}dv +$$ + +where $C$ is a closed contour in the intersection of ROCs of $X(\frac{z}{v})$ and $H(v)$ or $X(v)$ and $H(\frac z v)$. + +let $v = \rho e^{j\theta}, z = r e^{j\varphi}$, + +then + +$$ +\mathcal Z[x(n)h(n)] = \frac{1}{2\pi}\int_{-\pi}^\pi X(\rho e^{j\theta})H(\frac r\rho e^{-j(\varphi - \theta)})d\theta +$$ + +### Mapping of ZT and LT + +$$ +z = e^{sT} ,\omega_s = \frac{2\pi}{T} +\\ +re^{j\theta} = e^{(\sigma + j\omega)T}\\ +$$ + +then, + +$$ +r = e^{\sigma T} = e^{2\pi\frac{\sigma}{\omega_s}}\\ +\theta = \omega T = 2\pi\frac{\omega}{\omega_s} +$$ + +when $\sigma$ is constant, + +vertical line in $s$-plane maps the circle in $z$-plane. + +$s$-plane imaginary axis maps the unit circle in $z$-plane. + +when $\omega$ is constant, + +![](../images/ss/lec19_2jpg.jpg) + +**Correspondence of ZT and LT** + +![](../images/ss/lec19_3.jpg) + +### Solving difference equation by Z-T + +$$ +\sum_{k = 0}^N a_ky(n-k) = \sum_{r = 0}^M b_rx(n-r) +$$ + +Two methods: + +* TD method +* Z-T method (notice the ROC) + +**ZT method** + +1. perform unilateral Z-T on both sides. + +$x(n-r), y(n-k)$ are both right shifted series + +$$ +\sum_{k = 0}^N a_kz^{-k}[Y(z) + \sum_{l = -k}^{-1}y(l)z^{-l} ]= \sum_{r = 0}^M b_rz^{-r}[X(z) + \sum_{m = -r}^{-1}x(m)z^{-m} ] +$$ + +2. Derive $Y(z)$ +3. Perform inverse transform on $Y(z)$ to get $y(n)$(ROC!) + +**Zero input response** + +$$ +x(n) = 0\\ +Y(z) = \frac{-\sum_{k = 0}^M[a_kz^{-k}\cdot \sum_{l = -k}^{-1}y(l)z^{-l}]}{\sum_{k = 0}^Na_kz^{-k}} +$$ + +**Zero state response** + +$$ +y(l) = 0\\ +\text{ casual sequence }: x(m) = 0\\ +\sum_{k = 0}a_kz^{-k}Y(z) = \sum_{r = 0}^M b_rz^{-r}X(z)\\ +Y(z) = X(z)\cdot\frac{\sum_{r = 0}^M b_rz^{-r}}{\sum_{k = 0}^Na_kz^{-k}} = X(z)\cdot H(z) +$$ + +### System function of DT system + +**Unit Impulse/sample response $h(n)$ and system function H(z)** + +$$ +y(n) = x(n) * h(n)\\ +Y(z) = H(z)\cdot X(z) +$$ + +$$ +H(z) = \frac{Y(z)}{X(z)} = \frac{\sum_{r = 0}^M b_rz^{-r}}{\sum_{k = 0}^Na_kz^{-k}} +$$ + +Factorization + +$$ +H(z) = \frac{\prod_{r = 1}^M(1-z_rz^{-1})}{\prod_{k=1}^N1-p_kz^{-1}} +$$ + +We can draw the conclusions directly from the relationship between Z-T and L-T + +|||||| +|----|----|----|----|----| +| Imaginary axis | $\sigma=0$ | Constant amplitude | $r = 1$ | Unit circle | +Right half plane | | | | +Left half plane +Real axis + +![](../images/ss/lec20_1.jpg) + +![](../images/ss/lec20_2.jpg) + +**Stability and Causality** + +Stable: iff + +$$ +\sum_{n=-\infty}^\infty |h(n)|\lt \infty +$$ + +$$ +z = 1, H(z) = \sum_{n=-\infty}^\infty h(n)\lt \infty +$$ + +The condition is ROC of stable system includes the unit circle. + +Causal: + +$$ +h(n) = h(n)u(n) +$$ + +Condition is ROC includes $\infty$: $R_{X_1}\lt |z|$ + +**Stable and causal** + +$$ +a\le |z| \le \infty, a\le 1 +$$ + +### Discrete-time Fourier Transform(DTFT) + +**Definition** + +$$ +\mathcal{F}[x(t)\delta_T(t)] = \int_{-\infty}^\infty x(t)\delta_T(t)e^{-j\omega t}dt = \sum_{n=-\infty}^\infty x(nT)e^{-j\omega nT} +$$ + +take $T = 1$ + +$$ +\sum_{n=-\infty}^\infty x(n)e^{-j\omega n} = \text{DTFT[x(n)]} +$$ + +The relation ship with Z-T: + +$$ +X(z) = \sum_{n = -\infty}^\infty x(n)z^{-n}, z = e^{j\omega}\\ +$$ + +$$ +DTFT[x(n)] = X(z)|_{|z|=1} = X(z)|_{z = e^{j\omega}} = X(e^{j\omega}) +$$ + +Inverse transform + +$$ +x(n) = \frac{1}{2\pi j}\oint_{|z| = 1}X(z)z^{n-1}\mathrm dz=\frac{1}{2\pi}\int_{-\pi}^\pi X(e^{j\omega})e^{j\omega n}\mathrm d\omega +$$ + +### Frequency Response of DT system + +The steady-state response to sine sequence + +$$ +x(n) = A\sin(n\omega)(n\ge 0)\\ +y_{ss}(n) = A|H(e^{j\omega})|\sin(n\omega + \varphi)\\ +H(e^{j\omega}) = \sum_{n=-\infty}^\infty h(n)e^{-jn\omega} +$$ + +The FT of $h(n)$, $H(e^{j\omega})$ is a periodic function with period of $\omega_s = 2\pi /T = 2\pi$. + +If $h(n)$ is real, then the amplitude/phase response is even/odd function. + +The amplitude is determined within $[0, \omega_s/2]$ + +![](../images/ss/lec20_3.jpg) + +![](../images/ss/lec20_4.jpg) + +NOTE: + +* We can derive the frequency response (function of $\omega$) by letting $D$ move along the unit circle once. +* $H(j\omega)$ is periodic. The frequency response from 0 to $\omega_s/2$ can be determined by letting $D$ move along half circle. +* If pole $p_i$ is close to the unit circle, there will be a peak in the frequency response. If zero $z_i$ is close to the unit circle, there will be a notch in the frequency response. +* For statble systems, $p_i$ should be inside the unit circle, while $z_i$ could be inside or outside the unit circle. +* poles and zeros at origin have no influence on amplitude. + +### Analog and digital Filter + +**Fundamental Principles** + +![](../images/ss/lec20_5.jpg) + +The spectrum of $x(t)$ is strictly inside $\pm \omega_m$. + +We choose the sampling frequency:$\omega_s = \frac{2\pi}{T} \ge 2\omega_m$ + +![](../images/ss/lec20_6.jpg) + +**Classifications of digital filters** + +$$ +y(n) = \sum_{k=0}^M b_kx(n-k) - \sum_{k=1}^N a_ky(n-k) +$$ + +In terms of structure + +recursive: $a_k\ne 0$ at least for one $k$ + +non-recursive: $a_k=0$, for all $k$ + +In terms of the characteristics of $h(n)$ + +Infinite impulse response(IIR): recursive, non-linear phase + +Finite impulse response(FIR): non-recursive, linear phase. + +**IIR filter** + +Impulse invariance + +Based on the s-domain analog filters. + +Design method 1: **冲激响应不变法** + +Replace $\frac{1}{s-s_k}$ with $\frac{1}{1-e^{s_kT}z^{-1}}$. Then $H_a(s)$ become $H(z)$. + +The relationship between the continuous and discrete filters: + +$$ +H(z)|_{z = e^{sT}} = \frac{1}{T}\sum_{k=-\infty}^\infty H_a(s + j\frac{2\pi}{T}k) +$$ + +The result is just repeat the original filter at sampling frequency, thus it attenuates slower. + +NOTE:The digital filter implemented this way has aliasing. + +The frequency response of analog filter must be attenuated enough within $\omega_s$. + +This approach can only realize LP and BP filter, but not HP and band-stop one. + +**method 2: Bilinear transformation** emerges to address this problem (you can study it by yourself) + +$$ +s = \frac{2}{T}\left(\frac{1 - z^{-1}}{1 + z^{-1}}\right)\\ +z = \frac{1 + \frac{sT}{2}}{1 - \frac{sT}{2}} +$$ + +Bilinear transformation is non-linear transformation. + +To implement digital filter, A/D and D/A are required, along with ROM, RAM, ALU, delay units (shift registers), etc. + + +**FIR filter** + +$$ +H(z) = \sum_{k = 0}^{N-1}b_kz^{-k} = \sum_{n=0}^{N-1}h(n)z^{-n} +$$ + +Poles are at $z=0$. $N - 1$ zeros. + +FIR filter has linear-phase iff + +$$ +h(n) = h(N - 1 - n)(\text{evenly symmetric})\\ +h(n) = -h(N - 1 - n)(\text{oddly symmetric}) +$$ + +![](../images/ss/lec20_7.jpg) + +![](../images/ss/lec20_8.jpg) + +### Feedback System: Signal Flow Graphs + +**Operator and Transfer Operator:** + +$$ +p = \frac{d}{dt}\\ +\frac{1}{p} = \int_{-\infty}^t(\cdot)d\tau +$$ + +$$ +(C_0p^n + C_1p^{n-1} + \dotsb + C_n)r(t) = (E_0p^m + E_1p^{m - 1} + \dotsb + E_m)e(t)\\ +D(p)r(t) = N(p)e(t) +$$ + +Rules: + +* Common factors can't be eliminated. +* Be careful when changing the order of operation($\frac{d}{dt}\int_{-\infty}^tx(\tau)d\tau = x(t)$, $\int_{-\infty}^t\frac{d}{d\tau}x(\tau)d\tau = x(t) - x(-\infty)$) + +transfer operator: + +$$ +r(t) = \frac{N(t)}{D(t)}e(t) = H(p)e(t) +$$ + +**Brief introduction to the signal flow graphs(SFG)** + +![](../images/digital/lec_11_1.jpg) + +![](../images/ss/lec21_4.jpg) + +Terminnologies in SFG + +Node, Transfer function, Branch(The branch gain is the transfer function), Source node, Sink node, Mixed node. + +**Properties of SFG** + +1. Signal only passes through a branch with the direction indicated by the arrowhead. +2. Signals of incoming branches are added at a node, and the added signal appears on the all outgoing branches. +3. A sink node can be separated from a mixed node. +4. For a given system, the SFGs can be different.(equations for a system can be different) +5. After the SFG being inversed, the transfer function keeps invariant, but the signals represented by the inner nodes will be different. + + +Note: Inversion is done by inversing the transfer direction of each branch, and exchanging the source and sink nodes as well. + +Algebra of SFG + +![](../images/ss/lec21_5.jpg) + +![](../images/ss/lec21_6.jpg) + +Simplify: + +NOTE: The SFG can be simplified using the following steps: + +a. Merge the cascaded branches to decrease the number of nodes; + +b. Merge the parallel branches to decrease the number of branches; + +c. Eliminate all the loops. + +Then, the system function can be readily derived. + +![](../images/ss/lec21_7.jpg) + +**Mason's Formula** + +$$ +H = \frac{1}{\Delta} \sum_k g_k\Delta_k +$$ +![](../images/ss/lec21_9.jpg) + +## State-variable analysis of system + +$$ +\mathbf {\lambda = A\lambda + Be}\\ +\mathbf{r = C\lambda + De} +$$ + +Features of the state-variable analytical method + +* (1)Provide internal characteristics of the system +* (2) Convenient to represent and analyze the multi-input, multi-output (MIMO) cases +* (3) Easy to be extended to time-variant or nonlinear cases +* (4) Introduce two important concepts: controllability and observability +* (5) Convenient for numerical computation + +### General form and setup method (CT) + +$$ +\frac{d}{dt}\mathbf{\lambda}(t)_{k \times 1} = \mathbf{A}_{k \times k}\mathbf{\lambda}(t)_{k \times 1} + \mathbf{B}_{k \times m}\mathbf{e}(t)_{m \times 1}\\ +\mathbf{r}(t)_{r \times 1} = \mathbf{C}_{r \times k}\mathbf{\lambda}(t)_{k \times 1} + \mathbf{D}_{r \times m}\mathbf{e}(t)_{m \times 1} +$$ + +$r$ responses, $k$ state variables, $m$ inputs. + +For time-variant system, $\mathbf{A, B, C, D}$ are fuction of $t$. + +Direct methods: +* observation +* Topological analysis + +Used in curcuit analysis. + +Indirect methods: +* From block diagram or flow graph +* From input-output equation +* From transfer function + +Used in controlled system analysis. + +**From input-output equation** + +$$ +\frac{r(t)}{e(t)} = \frac{b_0p^k + \dotsb + b_k}{p^k + \dotsb + a_k} +$$ + +NOTE : under the zero-state condition, $p$ is equivalent to $s$ + +$$ +H(p) = \frac{b_0 + b_1p^{-1} + \dotsb + b_kp^{-k}}{1 + a_1p^{-1} + \dotsb + a_kp^{-k}} +$$ + +The SFG is: + +![](../images/ss/lec22_11.jpg) + +$$ +\dot{\lambda}_1 = \lambda_2\\ +\dot{\lambda}_2 = \lambda_3\\ +\vdots\\ +\dot{\lambda}_k = -a_k\lambda_1 - a_{k-1}\lambda_2 - \dotsb - a_1\lambda_k + e(t)\\ +r(t) = b_k\lambda_1 + b_{k-1}\lambda_2 + \dotsb + b_1\lambda_k + b_0(-a_k\lambda_1 - a_{k-1}\lambda_2 - \dotsb - a_1\lambda_k + e(t))\\ +=(b_k - a_kb_0)\lambda_1 + (b_{k-1} - a_{k-1}b_0)\lambda_2 + \dotsb + (b_1 - a_1b_0)\lambda_k + b_0e(t) +$$ + +$$ +\mathbf A = \begin{bmatrix} + 0 & 1 & 0 & \dotsb & 0\\ + 0 & 0 & 1 & \dotsb & 0\\ + \vdots & \vdots & \vdots & \ddots & \vdots\\ + 0 & 0 & 0 & \dotsb & 1\\ + -a_k & -a_{k-1} & -a_{k-2} & \dotsb & -a_1 +\end{bmatrix}\\ +B = \begin{bmatrix} + 0\\ + 0\\ + \vdots\\ + 0\\ + 1 +\end{bmatrix}\\ +\mathbf C = \begin{bmatrix} + b_k - a_kb_0 & b_{k-1} - a_{k-1}b_0 & \dotsb & b_1 - a_1b_0 +\end{bmatrix}\\ +D = b_0 +$$ + +If the order of differential equation on the left side is higher than that on the right side: + +$$ +b_0 = 0, \mathbf{D} = 0 +$$ + +If the derivatives of the excitation on the right side are absent, + +$$ +\mathbf{C} = [b_k, 0, \dotsb, 0], \mathbf{D} = 0 +$$ + +**Factorizing Transfer operator** + +![](../images/ss/lec22_12.jpg) + +![](../images/ss/lec22_13.jpg) + +![](../images/ss/lec22_14.jpg) + +![](../images/ss/lec22_15.jpg) + +![](../images/ss/lec22_16.jpg) + +![](../images/ss/lec22_17.jpg) + +![](../images/ss/lec22_18.jpg) + +### Solving CT system's state equations + +**Time domain method** using computer. + +**Transform-domain(Laplace-tranform) method** + +$$ +\frac{d}{dt}\mathbf{}{\lambda}(t) = \mathbf{A\lambda}(t) + \mathbf{Be}(t)\\ +\mathbf{r}(t) = \mathbf{C\lambda}(t) + \mathbf{De}(t)\\ +\mathbf{\lambda}(0_-) = \begin{bmatrix} +\lambda_1(0_-)\\ +\lambda_2(0_-)\\ +\vdots\\ +\lambda_k(0_-)\\ +\end{bmatrix} +$$ + +$$ +s\mathbf \Lambda(s) - \mathbf{\lambda}(0_-) = \mathbf{A\Lambda}(s) + \mathbf{BE}(s)\\ +\mathbf{R}(s) = \mathbf{C\Lambda}(s) + \mathbf{DE}(s) +$$ + +$$ +\mathbf{\Lambda}(s) = (s\mathbf {I} - \mathbf{A})^{-1}\mathbf{\lambda}(0_-) + (s\mathbf {I} - \mathbf{A})^{-1}\mathbf{BE}(s)\\ +\mathbf R(s) =\mathbf{C} (s\mathbf {I} - \mathbf{A})^{-1}\mathbf{\lambda}(0_-) + (\mathbf C(s\mathbf {I} - \mathbf{A})^{-1}\mathbf{B + D)E}(s) +$$ + +Let $\Psi(s) = (s\mathbf I - \mathbf A)^{-1}$, which is called **characteristic matrix**. + +$$ +\mathbf\lambda(t) = \mathcal{L}^{-1}[\Psi(s)\lambda(0_-)] + \mathcal{L}^{-1}[\Psi(s)\mathbf{B}] * e(t)\\ +\mathbf r(t) = \mathbf{C}\mathcal{L}^{-1}[\Psi(s)\lambda(0_-)] + \lbrace\mathbf{C}\mathcal{L}^{-1}[\mathbf\Psi(s)\mathbf{B] + D}\delta(t)\rbrace * e(t) +$$ + +**Time-domain method** + +$$ +e^{\mathbf At} = \sum_{k = 0}^\infty \frac{1}{k!}A^kt^k +$$ + +properties + +$$ +e^{\mathbf At}e^{-\mathbf At} = \mathbf I\\ +e^{\mathbf At} = [e^{-\mathbf At}]^{-1}\\ +\frac{d}{dt}e^{\mathbf At} = \mathbf Ae^{\mathbf At} = e^{\mathbf At} \mathbf A\\ +$$ + +$$ +\frac{d}{dt}\mathbf \lambda(t) = \mathbf A\mathbf \lambda(t) + \mathbf B\mathbf e(t)\\ +e^{-\mathbf At}\frac{d}{dt}\mathbf \lambda(t) = e^{-\mathbf At}\mathbf A\mathbf \lambda(t) + e^{-\mathbf At}\mathbf B\mathbf e(t)\\ +\frac{d}{dt}e^{-\mathbf At}\mathbf \lambda(t) = e^{-\mathbf At}\mathbf B\mathbf e(t)\\ +\lambda(t) = e^{\mathbf At}\mathbf \lambda(0_-) + \int_0^te^{\mathbf A(t - \tau)}\mathbf B\mathbf e(\tau)d\tau\\ +=e^{\mathbf At}\lambda(0_-) + e^{\mathbf At} \mathbf B * \mathbf e(t) +$$ + +output + +$$ +\mathbf r(t) = \mathbf C e^{\mathbf At}\mathbf \lambda(0_-) + \mathbf C e^{\mathbf At} \mathbf B * \mathbf e(t) + \mathbf D\mathbf e(t)\\ += \mathbf C e^{\mathbf At}\mathbf \lambda(0_-) + [\mathbf C e^{\mathbf At} \mathbf B + \mathbf D\delta(t)] * \mathbf e(t) +$$ + +Correspond to LT: + +$$ +\mathcal{L}[e^{\mathbf At}] = (s\mathbf I - \mathbf A)^{-1} +$$ + +**Derive System Functions** + +![](../images/ss/lec22_19.jpg) + +![](../images/ss/lec22_20.jpg) + +### That for DT system + +**State equation setup** + +$$ +\begin{align*} + \mathrm\lambda(n + 1) &= \mathbf A\mathrm\lambda(n) + \mathbf B\mathrm x(n)\\ + \mathrm y(n) &= \mathbf C\mathrm\lambda(n) + \mathbf D\mathrm x(n) +\end{align*} +$$ + +Solving: + +$$ +\lambda(n) = \underbrace{A^n\lambda(0)u(n)}_{\text{Zero Input}} + \underbrace{\left[\sum_{i=0}^{n-1}A^{n-1-i}Bx(i)\right]u(n-1)}_{\text{Zero State}}\\ +y(n) = \underbrace{CA^n\lambda(0)u(n)}_{\text{Zero Input}} + \underbrace{\left[\sum_{i=0}^{n-1}CA^{n-1-i}Bx(i)\right]u(n-1) + Dx(n)u(n)}_{\text{Zero State}} +$$ + +The Impulse response is: + +$$ +h(n) = CA^{n-1}Bu(n-1) + D\delta(n) +$$ + +Calculate $A^n$: Cayley-Hamilton Theorem + +**ZT Solution** + +$$ +\begin{align*} + z\mathrm\Lambda(z) - z\lambda(0) &= \mathbf A\mathrm\Lambda(z) + \mathbf B\mathrm X(z)\\ + \mathrm Y(z) &= \mathbf C\mathrm\Lambda(z) + \mathbf D\mathrm X(z) +\end{align*} +$$ + +$$ +\mathrm \Lambda(z) = (z\mathbf I - \mathbf A)^{-1}\lambda(0) + (z\mathbf I - \mathbf A)^{-1}\mathbf B\mathrm X(z)\\ +\mathrm Y(z) = \mathbf C(z\mathbf I - \mathbf A)^{-1}\lambda(0) + \left[\mathbf C(z\mathbf I - \mathbf A)^{-1}\mathbf B + \mathbf D\right]\mathrm X(z) +$$ + +then + +$$ +\lambda(n) = \mathcal{Z}^{-1}\left[(z\mathbf I - \mathbf A)^{-1}z\right]\lambda(0) + \mathcal{Z}^{-1}\left[(z\mathbf I - \mathbf A)^{-1}\mathbf B\right] * \mathcal{Z}^{-1}\left[\mathrm X(z)\right]\\ +y(n) = \mathcal{Z}^{-1}\left[\mathbf C(z\mathbf I - \mathbf A)^{-1}z\right]\lambda(0) + \mathcal{Z}^{-1}\left[\mathbf C(z\mathbf I - \mathbf A)^{-1}\mathbf B + \mathbf D\right] * \mathcal{Z}^{-1}\left[\mathrm X(z)\right] +$$ + +Comparing this with CT solution, we find + +$$ +A^n = \mathcal{Z}^{-1}\left[(\mathbf I - z^{-1}\mathbf A)^{-1}\right]\\ +$$ + +$$ +H(z) = C(\mathbf I - z^{-1}\mathbf A)^{-1}\mathbf B + D +$$ + +### Linear Transform on state vectors + +$$ +\mathbf{\gamma} = \mathbf P\mathbf \lambda +$$ + +The equations become: + +$$ +\frac{d}{dt}\gamma(t) =\mathbf{PAP}^{-1}\mathbf \gamma(t) + \mathbf{PB}e(t)\\ +\mathbf y(t) = \mathbf {CP}^{-1}\gamma(t) + \mathbf D\mathbf e(t) +$$ + +Similarity transform doesn't change the eigenvalues. + +**Transform function matrix keeps invariant under linear transformation.** + +We can **diagonalize** the matrix A. + +Calculate eigenvalues $\alpha$ -> calulate eigenvectors $\xi$ -> $\mathbf P^{-1} = [\xi_i]$, $\hat A = \text{diag}(\alpha_i)$ + +### Controllable & Observable + +Controllable is + +$$ +\text{rank} [A\ AB\ \dots\ A^{k-1}B] \text{ is full} +$$ + +Uncontrollabilty is the input can't change the response. + +Obeservability is + +$$ +\text{rank} \begin{bmatrix} + C\\ + CA\\ + \vdots\\ + CA^{k-1} + \end{bmatrix} + \text{ is full} +$$ + +Unobserverbility is the response is not affected by the input. + +After the diagonalization of A: + +B doesnt contain zero $\Leftrightarrow$ completely controllable. Otherwise, the 0s is coresponding to the uncontrollable state variables. + +C doesnt contain zero $\Leftrightarrow$ completely observable. Otherwise, the 0s is coresponding to the unobservable state variables. + +In fact: + +$$ +H(s) = C(s\mathbf I - \mathbf A)^{-1}\mathbf B + D \stackrel{D = 0}{=} \sum_{i=1}^n \frac{C_iB_i}{s - \alpha_i} +$$ + +The $H(s)$ only contains the controllable and observable state variables. So the state and output equations contains more information than the $H(s)$. + +![](../images/ss/lec23_1.jpg) + +## CDMA + +Use a set of orthogonal codes to support multiple users by orthorgonal multiplexing. + +### Example + +Assume K users need to connect with the base station simultaneously for CDMA system. + +1. Design a set of orthogonal codes +2. Design on the transmitter +3. Design on the receiver + +An example of Code 4: + +$$ +\begin{align*} + \mathbf c_1 &= [1\ 1\ 1\ 1\ -1\ -1\ -1\ -1]\\ + \mathbf c_2 &= [1\ 1\ -1\ -1\ 1\ 1\ -1\ -1]\\ + \mathbf c_3 &= [1\ -1\ 1\ -1\ 1\ -1\ 1\ -1]\\ + \mathbf c_4 &= [1\ -1\ -1\ 1\ 1\ -1\ -1\ 1] +\end{align*} +$$ + +$$ +R_{x, y}(j) = \begin{cases} + \sum_{k = 0}^{N - 1 - j} x(k)y(k + j), &0 \le j \le N - 1\\ + \sum_{k = 0}^{N - 1 + j} x(k - j)y(k), &-N + 1 \le j \le 0\\ + 0, & |j| \ge N +\end{cases} +$$ + +Must satisfy: + +$$ +R_{k, i} \begin{cases} + =T, &k = i, \tau=0\\ + \ll T, &k \ne i \text{ or } \tau \ne 0 + \end{cases} +$$ + +second: + +(1) frequency shifting: $d_k(t)\cos(\omega t)$ + +(2) spreading: $s_k(t) = d_k(t)c_k(t)\cos(\omega t)$ + +third: coherent detection/de-spreading + +Core: + +* Orthogonal code design(signal design) +* Code capturing and tracking(signal processing and system design) +* Multi-use detection and channel estimation(singal processing and system design) + +### Code design + +requirements: + +* sharp auto-correlation curve +* zero cross-correlation +* largest possible orthogonal code set +* highest possible complexity for security performance + +Commonly used codes: + +* Walsh code +* PN sequence +* GOLD codes + +$$ +H_1 = (0)\\ +H_2 = \begin{pmatrix} + H_1 & H_1\\ + H_1 & \overline{H_1} +\end{pmatrix} = \begin{pmatrix} + 0 & 0\\ + 0 & 1 +\end{pmatrix}\\ +H_4 = \begin{pmatrix} + H_2 & H_2\\ + H_2 & \overline{H_2} + \end{pmatrix} +$$ + +* sliding window capturing +* multiple correlators to detect phase match + +The period of address code is much shorter than the period of data code: $T_c < T_d$, so the modulated signal is much wider in FD, whose spectrum is called **spread spectrum**. \ No newline at end of file diff --git a/blitherboom-blog/pages/posts/Speech-SP.md b/blitherboom-blog/pages/posts/Speech-SP.md new file mode 100644 index 00000000..7490ef0a --- /dev/null +++ b/blitherboom-blog/pages/posts/Speech-SP.md @@ -0,0 +1,6 @@ +--- +title: Speech-SP +katex: true +date: 2024-02-28 19:24:02 +tags: +--- diff --git a/blitherboom-blog/pages/posts/StaSP.md b/blitherboom-blog/pages/posts/StaSP.md new file mode 100644 index 00000000..f3ee5df8 --- /dev/null +++ b/blitherboom-blog/pages/posts/StaSP.md @@ -0,0 +1,491 @@ +--- +title: Statistical Signal Processing +katex: true +date: 2024-02-26 11:12:57 +tags: +--- + +## 参数估计 + +分类: + +* 经典估计 +* 贝叶斯估计 + +准则: + +* MSE,均方误差 + +$$ +\hat \theta = f(\bm{x}) +$$ + +### MSE + +$$ +\text{mse}(\hat \theta) = E \lbrace(\theta - \hat \theta)^2\rbrace = \text{var}(\hat \theta) + b^2(\hat \theta)\\ +b^2(\hat \theta) = E(\hat \theta) - \theta +$$ + +现实中无法直接计算 MSE,因为涉及到真值 $\theta$,但是 $\theta$ 是我们要求的参数。 + +### MVU + +最小方差无偏估计 + +MVU, Minimum Variance Unbiased + +无偏: + +$$ +E(\hat \theta) = \theta, a \lt \theta \lt b +$$ + +无偏的含义:$\hat \theta$ 的求法需要对取值范围内任意的 $\theta$ 进行估计。 + +无偏估计是否一定存在?不一定。 + +最小方差: + +$$ +\min \text{var}\lbrace\hat\theta\rbrace +$$ + +MVU的内涵:估计值的发散程度最小(最小方差),平均意义上靠近真值(MVU)。是对 MSE 的迂回实现。 + +### 克拉美罗界定理(CRLB) + +假设 $p(\bm{x};\theta)$ 满足正则条件: + +$$ +E \left [ \frac{\partial\ln p(\bm{x};\theta)}{\partial\theta} \right] = 0 +$$ + +则 + +$$ +\text{var}(\hat\theta) \ge \frac{1}{E \left [\left( \frac{\partial\ln p(\bm{x};\theta)}{\partial\theta}\right)^2 \right]} = - \frac{1}{E \left [ \frac{\partial^2\ln p(\bm{x};\theta)}{\partial\theta^2} \right]} +$$ + +等号成立的充要条件:找到函数 $I, g$ + +$$ +\frac{\partial \ln p(\bm{x};\theta)}{\partial \theta}= I(\theta)(g(\bm{x}) - \theta)\\ +\hat \theta = g(\bm{x}) +$$ + +此时有 $\text{var}(\hat\theta) =1 / I(\theta)$。 + +### 求解MVU + +$$ +\frac{\partial \ln p(\bm{x};A)}{\partial A} = \frac{1}{\sigma^2}\sum\limits_{n=0}^{N - 1}(x[n] - A) = \frac{N}{\sigma^2}\left (\frac{1}{N}\sum\limits_{n=0}^{N - 1}(x[n] - A) \right) +$$ + +$$ +g(\bm{x}) = \frac{1}{N}\sum\limits_{n=0}^{N - 1}x[n]\\ +I(\theta) = \frac{N}{\sigma^2} +$$ + +有效估计量:能达到克拉美罗下界的估计量,是MVU的子集。 + +### 参数变换的克拉美罗界 + +若 + +$$ +\alpha = g(\theta) +$$ + +则 + +$$ +CRLB(\hat \alpha) = \left(\frac{\partial g(\theta)}{\partial \theta}\right)^2CRLB(\hat \theta) +$$ + +对于高斯分布有 + +$$ +E(x^2) = \mu^2 + \sigma^2\\ +E(x^4) = \mu^4 + 6\mu^2\sigma^2 + 3\sigma^4 +$$ + +当数据量很大时 + +有效估计量靠近真值:$N \rightarrow \infty, \hat\theta \rightarrow \theta$ + +非线性变换渐进有效,可以看成线性函数:$g(\hat \theta) \approx g(\theta) + \frac{\partial g(\theta)}{\partial\theta}(\hat \theta - \theta)$ + +### 矢量参数的克拉美罗界 + +$$ +E \left [ \frac{\partial \ln p(\bm{x};\bm{\theta})}{\partial \bm{\theta}} \right] = 0 +$$ + +$$ +\alpha = g(\theta) +$$ + +![](../images/StaSP/1_1.jpg) + +注意:$\bm T(\bm x)$ 的维度要和 $\bm \theta$ 的维度相同 + +## 线性模型方法 + +$$ +x = H\theta + w, w \sim N(0, \sigma^2I) +$$ + +$$ +p(x;\theta) = \frac{1}{(2\pi\sigma)^{N/2}}\exp \lbrace -\frac{1}{2\sigma^2}(x - H\theta)^T(x - H\theta) \rbrace +$$ + +$$ +\frac{\partial \ln p(x;\theta)}{\partial \theta} = \frac{H^TH}{\sigma^2}\lbrace (H^TH)^{-1}H^Tx - \theta \rbrace +$$ + +从而 + +$$ +\hat \theta = (H^TH)^{-1}H^Tx\\ +C_{\hat\theta} = \sigma^2(H^TH)^{-1} +$$ + +这个 MVU 估计量满足 + +$$ +\hat \theta \sim N(\theta, \sigma^2(H^TH)^{-1}) +$$ + +* 要求观测数据与待估计参数间呈线性关系 +* 要求噪声是高斯白噪声 +* 要求观测矩阵是满秩的 +* 所得估计量是有效估计量 + +一般信号模型 + +$$ +x = H\theta + s + w, s已知,w \sim N(0, C) +$$ + +结论 + +$$ +\hat \theta = (H^TC^{-1}H)^{-1}H^TC^{-1}(x - s)\\ +C_{\hat\theta} = (H^TC^{-1}H)^{-1} +$$ + +## 充分统计量方法 + +$$ +p(x|T(x);\theta) = p(x|T(x)) +$$ + +则称 $T(x)$ 为充分统计量 + +充分统计量的性质: + +* 一旦充分统计量确定,似然函数就与待估计参数无关 +* 充分统计量依赖于待估计参数。待估计参数变化,其相应的充分计量一般也会变化 +* 所谓“充分”,是相对于原始观测数据而言的原始观测量总是充分统计量,但通常不是最小集 +* 充分统计量并不唯一 + +若 + +$$ +\int_{-\infty}^{\infty}v(T)p(T;\theta)\mathrm dT = 0 +$$ + +对所有的 $\theta$ 并非都满足,只对零函数 $v(T) = 0$ 成立,则称充分统计量是完备的。 + +* 一般地,当待估计参数发生变化时,充分统计量也会发生变化 +* 一旦充分统计量确定以后,似然函数就与待估计参数无关 + +### Neyman-Fisher因子分解定理 + +如果概率密度函数(或概率质量函数,对于离散随机变量)$p(x; \theta)$ 可以被分解为 + +$$ +p(x; \theta) = g(T(x); \theta) \cdot h(x) +$$ + +其中: + +- $g(T(x); \theta)$ 是一个只通过统计量 $T(x)$ 并依赖于参数 $\theta$ 的函数。 +- $h(x)$ 是只与观测数据 $x$ 相关的函数,与参数 $\theta$ 无关。 + +那么,统计量 $T(x)$ 是参数 $\theta$ 的充分统计量。反之,如果 $T(x)$ 是参数 $\theta$ 的充分统计量,那么概率密度函数 $p(x; \theta)$ 必然可以分解为上述形式。 + +### Rao-Black-Lehmann-Scheffe(RBLS)定理 + +若 $\breve\theta$ 是$\theta$的无偏估计,$T(x)$是$\theta$的充分统计量,那么$\hat \theta=E(\breve{\theta}|T(x))$ + +1. 是$\theta$ 的一个适用的估计量(与$\theta$无关) +2. 无偏的 +3. 对所有的 $\theta$,它的方差小于等于$\breve\theta$ 的方差 +4. 若$T(x)$是完备的,那么$\theta$是MVU估计量 + +#### 矢量参数的 RBLS + +![](../images/StaSP/2_1.jpg) + +![](../images/StaSP/2_2.png) + +## BLUE + +### 定义 + +直接求出数据->参数的映射 $\bm A_{p \times N}$: + +$$ +\bm x = \bm H \theta\\ +\hat {\theta}_{p \times 1} = \bm A\bm x +$$ + +无偏性: + +$$ +\theta = E(\hat\theta) = \bm AE(\bm x) = \bm AH\theta\\ +\Rightarrow AH = I_{p \times p} +$$ + +最佳(最小方差) + +$$ +\min \lbrace a_i^TCa_i \rbrace, A = [a_1, a_2, \dots, a_n]^T +$$ + +其中 + +$$ +C = E \lbrace (x - E(x))(x - E(x))^T \rbrace +$$ + +### 高斯-马尔可夫定理 + +如果数据具有一般线性模型的形式 + +$$ +\bm x = \bm H \theta + w +$$ + +其中 $\bm H$ 为已知 $N \times p$ 矩阵,$\theta$ 为待估计参数,$w$ 是均值为零、协方差为 $\bm C$ 的噪声矢量(**不一定为高斯**),则 BLUE 估计量为 + +$$ +\hat \theta = (H^TC^{-1}H)^{-1}H^TC^{-1}x\\ +C_{\hat\theta} = (H^TC^{-1}H)^{-1} +$$ + +* 若为高斯噪声,则BLUE为MVU,且为有效估计量 + +## MLE + +### 定义 + +$$ +\hat \theta = \arg\max\limits_\theta p(\bm{x};\theta) +$$ + +如果 PDF 可导 + +$$ +\frac{\partial p(\bm x; \theta)}{\partial \theta}\bigg|_{\hat\theta} = 0\\ +\Rightarrow\frac{\partial \ln p(\bm x; \theta)}{\partial \theta}\bigg|_{\hat\theta} = 0 +$$ + +若有效估计量存在,$\frac{\partial \ln p(\bm x; \theta)}{\partial \theta}\bigg|_{\hat\theta} = I(\theta)(g(x) - \theta)$,则可以使用最大似然估计方法求得结果。 + +### MLE 的性质 + +如果数据 $\bm x$ 的 PDF $p(\bm x;\theta)$ 满足“正则”条件,那么 +对于足够多的数据记录,未知参数 $\theta$ 的 MLE 渐近服从 + +$$ +\hat\theta \stackrel{a}{\sim} N(\theta, I^{-1}\theta) +$$ + +其中 $\theta$ 是在未知参数真值处计算的 Fisher 信息。 + +MLE是渐近无偏的 + +MLE渐近达到CRLB + +MLE是渐近有效的 + +MLE是渐近最佳的 + +* MLE的方差(协方差)可大于、等于、小于CRLB!(不同于MVU估计) +* 但数据量足够多时,将与CRLB接近 +* 因此,可利用CRLB评估MLE的性能 + +“足够多”数据:大量能带来新信息的数据 + +**MLE的不变性** + +若参数 $\alpha = g(\theta)$,则 + +$$ +\hat\alpha = g(\hat\theta) +$$ + +若 $g$ 非一对一函数,那么 $\hat\alpha$ 是使修正后的似然函数 $p_T(\bm x;\alpha)$ 最大者 + +$$ +\hat\alpha = \arg\max_\alpha p_T(\bm x; \alpha)\\ +p_T(\bm x; \alpha) = \max_{\theta: \alpha=g(\theta)}p(\bm x; \theta) +$$ + +该性质对函数 $g$ 无线性变换要求,对任意函数均成立。 + +对比MVU + +* 无偏性、有效性仅对线性变换成立 +* 对非线性变换不能保持(但渐近无偏、渐近有效) + +对一般线性模型,MLE是MVU,达到了CRLB,是有效的、最佳的! + +![1711254850893](../images/StaSP/1711254850893.png) + +## 最小二乘估计(LS) + +### 线性最小二乘估计 + +![1711339154789](../images/StaSP/1711339154789.png) + +### 加权最小二乘估计 + +![1711339192281](../images/StaSP/1711339192281.png) + +### 约束最小二乘估计 + +![1711339216759](../images/StaSP/1711339216759.png) + +### 比较 + +![1711339249863](../images/StaSP/1711339249863.png) + +## 经典估计方法比较 + +### 噪声电平估计问题 + +$$ +x[n] = A + w[n] +$$ + +其中 $w[n] \sim N(0, \sigma^2)$,待估计参数 $\theta = [A, \sigma^2]^T$ + +#### MVU估计 + +$$ +p(x;\theta) = \frac{1}{(2\pi\sigma^2)^{N/2}}\exp \lbrace -\frac{1}{2\sigma^2} \sum\limits_{n=0}^{N - 1}(x[n] - A)^2\rbrace +$$ + +$$ +\frac{\partial \ln p (x;\theta)}{\partial A} = \frac{1}{\sigma^2}\sum\limits_{n=0}^{N - 1}(x[n] - A) +$$ + +$$ +\frac{\partial \ln p(x;\theta)}{\partial \sigma^2} = \frac{N}{2\sigma^2} + \frac{1}{2\sigma^4}\sum\limits_{n=0}^{N - 1}(x[n] - A) +$$ + +![1711339773571](../images/StaSP/1711339773571.png) + +![1711339786814](../images/StaSP/1711339786814.png) + +#### 线性模型 + +$$ +\hat\theta = (\bm H^T\bm H)^{-1}\bm H^T x +$$ + +![1711339831807](../images/StaSP/1711339831807.png) + +#### BLUE + +$$ +\hat\theta = (\bm H^T\bm C^{-1}\bm H)^{-1}\bm H^T\bm C^{-1} x +$$ + +![1711339865703](../images/StaSP/1711339865703.png) + +#### 充分统计量 + +![1711340151724](../images/StaSP/1711340151724.png) + +![1711340163113](../images/StaSP/1711340163113.png) + +![1711340177961](../images/StaSP/1711340177961.png) + +#### MLE + +![1711340277148](../images/StaSP/1711340277148.png) + +#### LSE + +![1711340293644](../images/StaSP/1711340293644.png) + +## 贝叶斯估计 + +贝叶斯MSE: +Bmse$\left(\hat{\theta}\right)=E\left(\left(\theta-\hat{\theta}\right)^2\right)$ + + +$=\int\int\left(\theta-\hat{\theta}\right)^{2}p\big(\mathbf{x},\theta\big)d\mathbf{x}d\theta$ $=\iint\left(\theta-\hat{\theta}\right)^2p\big(\boldsymbol{x}|\theta\big)p\big(\theta\big)d\boldsymbol{x}d\theta$ + $=\iint\left(\theta-\hat{\theta}\right)^2p(x|\theta)dxp(\theta)d\theta$ + +$\hat{\theta}=E\big(\theta|x\big)$ + +多余参数:未知,但不感兴趣的参数 + 解决思路:通过积分消除多余参数的影响 + (1) 后验概率中存多余参数时: + +$$ +p(\boldsymbol{\theta},\boldsymbol{\alpha}\mid\boldsymbol{x}) \Rightarrow p (\boldsymbol{\theta}\mid\boldsymbol{x})=\int p(\boldsymbol{\theta},\boldsymbol{\alpha}\mid\boldsymbol{x})\:d\boldsymbol{\alpha} +$$ + +(2) 条件概率中存在多余参数时: + +$$ +p(\boldsymbol{\theta}\mid\boldsymbol{x})=\frac{p(\boldsymbol{x}\mid\boldsymbol{\theta})p(\boldsymbol{\theta})}{\int p(\boldsymbol{x}\mid\boldsymbol{\theta})p(\boldsymbol{\theta})d\boldsymbol{\theta}} +$$ + +$$ +\text{若现只有 }p(x|\theta,\alpha)\text{,而无 }p(x|\theta) +$$ + 此时可通过积分方式解决 + +$$ +p(x\mid\theta)=\int p(x\mid\theta,\alpha)p(\alpha\mid\theta)d\alpha +$$ + +进一步地,若待估计参数与多余参数相互独立, + +$$ +p(x\mid\theta)=\int p(x\mid\theta,\alpha)p(\alpha)d\alpha +$$ + +矢量参数下贝叶斯估计 +若 θ 是 $p{\times}1$ 的矢量参数,那么为了估计其中某个参数 $\theta_i$, 可以将剩余参数当作多余参数,因此对$\theta_i$ 的MMSE为 + +$$ +\hat{\theta}_i=E\left(\theta_i\mid x\right)=\int\theta_ip(\theta_i\mid x)d\theta_i +$$ + 其中 + +$$ +p(\theta_i\mid x)=\int\cdots\int p(\theta\mid x)d\theta_1\cdots d\theta_{i-1}d\theta_{i+1}\cdots d\theta_p +$$ + +$$ +\hat{\theta}_i=\int\theta_i\left(\int\cdots\int p(\boldsymbol{\theta}\mid\boldsymbol{x})\underline{d\theta_1\cdots d\theta_{i-1}d\theta_{i+1}\cdots d\theta_p}\right)d\theta_i=\int\theta_ip(\boldsymbol{\theta}\mid\boldsymbol{x})d\boldsymbol{\theta} +$$ + +$$ +\Longrightarrow\hat{\theta}=\begin{bmatrix}\theta_1p(\theta|x)d\theta\\\int\theta_2p(\theta|x)d\theta\\\vdots\\\int\theta_pp(\theta|x)d\theta\end{bmatrix}=\int\theta_P(\theta|x)d\theta=E(\theta|x) +$$ + +### 贝叶斯风险 + +$$ +\Re=\iint C(\varepsilon)p(x,\theta)dxd\theta +$$ diff --git a/blitherboom-blog/pages/posts/Stochastic-Process.md b/blitherboom-blog/pages/posts/Stochastic-Process.md new file mode 100644 index 00000000..6e9f0908 --- /dev/null +++ b/blitherboom-blog/pages/posts/Stochastic-Process.md @@ -0,0 +1,2263 @@ +--- +title: Stochastic-Process +katex: true +date: 2023-09-21 10:10:49 +tags: note +--- + +## 随机过程随机过 + +信号与系统:研究确定信号随着时间、空间的变化 + +概率论:研究随机信号,但是不随时间、空间变化 + +随机过程:研究随机的信号随着时间、空间的变化 + +> 期末70分梭哈 +> +> 考试题目不随机,就跟不上这门课的要求。 + +### 概率与随机变量回顾 + +样本空间$\Omega$ + +性质: +* 非负性:$P(A) \ge 0$ +* 规范性:$P(\Omega), P(\emptyset) = 0$ +* 可加性:$P(\bigcup\limits_{k = 1}^{\infty}A_k) = \sum\limits_{k=1}^{\infty}P(A_k)$ + +贝叶斯: + +$$ +P(B_i|A) = \frac{P(A|B_i)P(B_i)}{\sum\limits_{j = 1}^{k}P(B_j)P(A|B_j)} +$$ + +随机变量: + +分布函数,概率密度函数 + +期望,方差,协方差,相关系数 + +伯努利分布,高斯分布,泊松分布,瑞利分布 + +伯努利分布的概率密度函数: + +当$k=1$时,$P(X=1) = p$ +当$k=0$时,$P(X=0) = 1-p$ + +高斯分布的概率密度函数: +$P(x) = \frac{1}{\sqrt{2\pi\sigma^2}}\exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)$ + +二维高斯分布的概率密度函数: + +$P(x,y) = \frac{1}{2\pi\sigma_x\sigma_y\sqrt{1-\rho^2}}\exp\left(-\frac{1}{2(1-\rho^2)}\left[\frac{(x-\mu_x)^2}{\sigma_x^2}-2\rho\frac{(x-\mu_x)(y-\mu_y)}{\sigma_x\sigma_y}+\frac{(y-\mu_y)^2}{\sigma_y^2}\right]\right)$ + +其中,$\mu_x$和$\mu_y$是均值,$\sigma_x$和$\sigma_y$是标准差,$\rho$是相关系数。 + +泊松分布的概率密度函数: +$P(k;\lambda) = \frac{\lambda^k}{k!}\exp(-\lambda)$ + +瑞利分布的概率密度函数: +$P(x;\sigma) = \frac{x}{\sigma^2}\exp\left(-\frac{x^2}{2\sigma^2}\right)$ + +### 随机过程的基本概念 + +定义: + +给定概率空间$(\Omega, \mathcal{F}, P)$,定义参数集$T \subset R$,$t \in T$ + +$$ +X = \lbrace X(t, \omega), t \in T, \omega \in \Omega \rbrace +$$ + +简记为$X(t)$: $X = \lbrace X(t), t \in T\rbrace$ + +解释: + +* 二元单值函数 +* 对每个固定t,$X(t, \omega)$是一个随机变量 +* 每个$\omega_0 \in \Omega$, $X(t, \omega_0)$是定义在T上的函数,记为$x(t, \omega_0)$ + +单样本为随机变量:均值、方差、协方差、有限维联合分布等 + +随机过程的函数特性:时间的相关性,连续性和离散性,随机过程的导数、微分、积分、卷积、级数展开、微分方程、积分方程等 + +二重性的联合特征: + +分类: + +离散时间,离散分布:Bernouli过程 + +离散时间,连续分布:自回归过程 + +连续参数离散随机过程:Poission过程 + +连续参数连续型随机过程:Brown运动 + +数学特征: + +相互独立和不相关是两个概念,无必然因果联系。 + +根据数字特征分类: + +* 独立增量过程 +* 平稳过程及二阶矩过程 +* 马尔可夫过程 +* 更新过程 + +独立增量过程是一种随机过程,具有以下特性: + +1. 零起点:独立增量过程在零时刻(通常表示为$t=0$)的取值为零,即$X(0) = 0$。 + +2. 独立增量:对于任意时刻$t_1 < t_2 < \cdots < t_n$,随机变量$X(t_2)-X(t_1), X(t_3)-X(t_2), \cdots, X(t_n)-X(t_{n-1})$是相互独立的。 + +若对一切$0\le s \lt t$,增量$X(t) - X(s)$的分布仅依赖于$t - s$,则称之为平稳增量,具有平稳增量的独立增量过程称为独立平稳增量过程,例如泊松和布朗。 + +二阶矩过程:$D(X(t))$ + +宽平稳过程: + +宽平稳过程可以用以下简单的数学表达式表示: + +1. 均值平稳性:对于宽平稳过程 $X(t)$,其均值满足 $E[X(t)] = \mu$,其中 $\mu$ 是一个常数。 + +2. 自相关平稳性:宽平稳过程的自相关函数在时间差 $\tau$ 下为常数,可以表示为 $R_X(\tau) = R_X(t,t+\tau) = \text{常数}$,其中 $R_X(\tau)$ 表示宽平稳过程的自相关函数。 + +严平稳过程(Strict-sense stationary process),也称为严格平稳过程或强平稳过程,是一种具有更强平稳性质的随机过程。它满足以下两个条件: + +1. 时移不变性:严平稳过程的统计性质在时间上任意平移保持不变。具体而言,对于任意时间差 $\tau$ 和任意时间点 $t$,随机变量 $X(t)$ 和 $X(t+\tau)$ 的联合分布相同,即联合分布满足 $P(X(t) \in A, X(t+\tau) \in B) = P(X(0) \in A, X(\tau) \in B)$,其中 $A,B$ 是任意集合。 + +2. 自相关平稳性:严平稳过程的自相关函数只与时间差有关,与参考时刻无关。具体而言,对于任意时间差 $\tau$ 和任意时间点 $t$,自相关函数满足 $R_X(t,t+\tau) = R_X(\tau)$,其中 $R_X(\tau)$ 表示严平稳过程的自相关函数。 + +马尔可夫过程是一种具有马尔可夫性质的随机过程。它可以用以下公式和概念来定义: + +1. 状态空间:马尔可夫过程的状态空间是一个离散集合,表示可能的状态集合。通常用符号 $S$ 表示,$S = \{s_1, s_2, \ldots\}$。 + +2. 马尔可夫性质:马尔可夫过程具有马尔可夫性质,也称为无后效性。即,在给定当前时刻的状态 $X(t)$ 之下,未来的状态 $X(t+\Delta t)$ 只依赖于当前的状态 $X(t)$,与过去的状态 $X(t-1), X(t-2), \ldots$ 无关。 + +3. 转移概率:转移概率描述了在给定当前状态 $s_i$ 的情况下,马尔可夫过程在下一个时刻转移到状态 $s_j$ 的概率。转移概率通常用符号 $P_{ij}$ 表示,即 $P_{ij} = P(X(t+\Delta t) = s_j \mid X(t) = s_i)$。 + +通过状态空间和转移概率,可以构建一个马尔可夫过程的状态转移矩阵(Transition Matrix),它描述了从一个状态到另一个状态的转移概率情况。 + +更新过程: + +更新过程可以使用以下公式来描述: + +1. 到达时间:假设到达时间的随机变量序列为 $T_1, T_2, T_3, \ldots$,其中 $T_i$ 表示事件 $i$ 的到达时间。 + +2. 描述参数:更新过程的到达率(或强度)表示单位时间内平均发生事件的次数。通常用符号 $\lambda$ 表示,即 $\lambda = \lim_{t \to \infty} \frac{N(t)}{t}$,其中 $N(t)$ 表示时间 $t$ 之前(包括 $t$)发生的事件次数。 + +3. 插值函数:更新过程的插值函数(或插值过程)表示给定时间 $t$ 时,最近的到达时间是多久之前。记为 $S(t)$,即 $S(t) = \sup\{T_i \leq t\}$,表示最近的到达时间小于等于 $t$ 的时间点。 + + +可以定义复随机过程: + + +复随机过程是一组复数值随机变量的集合 $\{X(t), t \in T\}$,其中 $X(t)$ 是定义在概率空间 $(\Omega, \mathcal{F}, P)$ 上的复数值随机变量,表示在时间点 $t$ 上的取值。 + +具体而言,对于每个时间点 $t \in T$,$X(t)$ 是一个复数值随机变量,可以表示为 $X(t) = R(t) + iI(t)$,其中 $R(t)$ 和 $I(t)$ 分别表示实部和虚部。 + +复随机过程可以通过概率空间 $(\Omega, \mathcal{F}, P)$ 上的复数随机变量以及时间参数 $T$ 来描述,并且在不同时间点上表现出复数值随机变量的随机性质。 + +数学特征: + +均值函数(一阶原点矩):$\mu_X(t) = E[X(t)]$ + +方差函数:$\text{Var}[X(t)] = E[(X(t) - \mu_X(t))(X(t) - \overline{\mu_X(t)} )]$ + +自相关函数:$R_X(t_1, t_2) = E[(X(t_1) - \mu_X(t_1))(X(t_2) - \overline{\mu_X(t_2)} )]$ + +自协方差函数:$\text{Cov}[X(t_1), X(t_2)] = E[(X(t_1) - \mu_X(t_1))(X(t_2) - \overline{\mu_X(t_2)} )]$ + +均方值函数:$E[|X(t)|^2] = \int_{-\infty}^{\infty} |x|^2 f_X(x,t)dx$ + +### 基本研究方法 + +* 相关方法 +* Markov 方法 + +**相关** + +若随机过程在任意时刻的均值和方差都存在,则称之为二阶矩过程(second order process),即均方可积空间上的随机变量。 + +均方可积空间是内积空间。相关运算是均方可积的内积运算: + +$$ +\langle X, Y \rangle = E(X\overline Y) +$$ + + +宽平稳(wide-sense stationary): + +$$ +R_X(t, s) = R_X(t + D, s + D) = R(t - s) +$$ + +功率谱密度: + +$$ +S_X(\omega) = \int_{-\infty}^{\infty}R_X(\tau)\exp(-j\omega\tau)\mathrm d\tau +$$ + +最优线性估计 + +**Markov** + + +有限维联合分布可以由各阶的条件分布表示出来: + +$$ +\begin{align*} + &F_{X(t_1), \dots, X(t_n)}(x_1, \dots, x_n) \\ + =&F_{X(t_n)|X(t_{n - 1}), \dots, X(t_1)}(x_n|x_{n - 1}, \dots, x_1)F_{X(t_{n - 1}), \dots, X(t_1)}(x_1, \dots, x_{n - 1})\\ + =&F_{X(t_n)|X(t_{n - 1}), \dots, X(t_1)}(x_n|x_{n - 1}, \dots, x_1)\dots F_{X(t_2)|X(t_1)}(x_2|x_1)F_{X(t_1)}(x_1) +\end{align*} +$$ + +无后效性的 markov 过程: + +$$ +F_{X(t_n)|X(t_{n - 1}), \dots, X(t_1)}(x_n|x_{n - 1}, \dots, x_1) = F_{X(t_n)|X(t_{n - 1})}(x_n|x_{n - 1}) +$$ + +从而所有高阶依赖关系都可以简化为二阶依赖: + +$$ +F_{X(t_1), \dots, X(t_n)}(x_1, \dots, x_n)=F_{X(t_n)|X(t_{n - 1})}(x_n|x_{n - 1})\dots F_{X(t_2)|X(t_1)}(x_2|x_1)F_{X(t_1)}(x_1) +$$ + +## 相关理论与二阶矩过程——时域分析 + +### 自相关函数 + +由二阶矩过程的定义可知,均方可积空间的自相关函数、自协方差函数、互相关函数、互协方差函数均存在。 + +均值函数(一阶原点矩):$\mu_X(t) = E[X(t)]$ + +方差函数:$\text{Var}[X(t)] = E[(X(t) - \mu_X(t))^2]$ + +自相关函数:$R_X(t_1, t_2) = E[(X(t_1))(X^*(t_2))]$ + +自协方差函数:$C_X(t_1, t_2) = \text{Cov}[X(t_1), X(t_2)] = E[(X(t_1) - \mu_X(t_1))(X(t_2) - \mu_X(t_2))^*]$ + +均方值函数:$E[X^2(t)] = \int_{-\infty}^{\infty} x^2 f_X(x,t)dx$ + +互相关函数和互协方差函数: + +* 如果$E[X(s)Y(t)]存在$,记为$R_{XY}(s, t)$ +* 如果$\text{cov}(X(s), Y(t))存在$,记为$C_{XY}(s, t)$ + +$$ +R_{XY}(t_1, t_2) = E[(X(t_1))(Y^*(t_2))] +$$ + +$$ +C_{XY}(t_1, t_2) = E[(X(t_1) - \mu_X(t_1))(Y(t_2) - \mu_Y(t_2))^*] +$$ + +$$ +C_{XY}(s, t) = R_{XY}(s,t) - \mu_X(s)\mu_Y(t) +$$ + +不相关: + +$$ +C_{XY}(s, t) = 0 +$$ + +$$ +R_{XY}(s,t) = m_X(s)m_Y(t) +$$ + + +自相关函数具有共轭对称性: + +$$ +R(t_1, t_2) = R^*(t_2, t_1) +$$ + +离散化的自相关矩阵同样是共轭对称的: + +$$ +R = E[XX^H]\\ +R_{ij} = R^*_{ji} +$$ + +自相关矩阵是非负定的: + +$$ +\lambda R \lambda^H = \lambda XX^H\lambda^H \ge 0 +$$ + +当 $P(\lambda X = 0) = 1$ 时等号成立。 + +非负定性是自相关函数的一种特征性质。如果一个二元函数满足非负定性质,则一定可以构造出一个随机过程,使得其自相关函数为给定的二元函数。 + +自相关矩阵非负定,分解的特征值均非负。其物理意义是信号的能量或者功率。 + +自相关函数对加法和乘法的封闭性: + +$$ +R(t, s) = \alpha R_1(t, s) + \beta R_2(t, s) +$$ + +仍然是某一随机过程的自相关函数。 + +证明:取 $Z(t) = \alpha^{1/2} X(t) + \beta^{1/2} Y(t)$。这里 $X(t), Y(t)$是独立的。 + +$$ +R(t, s) = R_1(t, s)R_2(t, s) +$$ + +也是自相关函数。取 $Z(t) = X(t)Y(t)$。 + +### 宽平稳随机过程 + +**宽平稳** + +对于随机过程 $X(t), t \in T$,若 $\forall t, s\in T$ + +$$ +E(X(t)) = E(X(s))\\ +R_X(t, s) = R_X(t + D, s + D) +$$ + +称随机过程 $X(t)$ 具有宽平稳性。 + +宽平稳过程的均值是常数,自相关函数与相对时间差有关。故宽平稳过程的自相关函数可以写成一元函数:$R_X(\tau), \tau = t - s$。 + +**严平稳** + +对于随机过程 $X(t), t \in T$,若 $\forall n, \forall t_1, t_2, \dots, t_n \in T$,$\forall D \in T$,都有 + +$$ +F_{t_1, t_2, \dots, t_n}(x_1, x_2, \dots, x_n) = F_{t_1 + D, t_2+D, \dots, t_n + D}(x_1, x_2, \dots, x_n) +$$ + +则称随机过程 $X(t), t\in T$具有严平稳性。 + +在二阶矩存在的条件下,严平稳蕴含宽平稳,而反过来,宽平稳一般无法得到严平稳。 + +高斯过程的严平稳与宽平稳等价。 + +**联合宽平稳** + +$$ +R_{X, Y}(t, s) = R_{XY}(t + D, s + D), \forall D \in T +$$ + +**宽平稳过程的性质** + +设 $R_X(\tau)$ 为宽平稳过程的自相关函数, $m_X$ 为该过程的均值。 + +$$ +\begin{align} + R_X(\tau) = \overline{R_X(-\tau)}\\ + R_X(0)\ge |m_X|^2\\ + |R_X(\tau)| \le R_X(0)\\ + R_X(\tau) \text{是一元非负定函数。} +\end{align} +$$ + +### 正交增量过程 + +**正交增量过程** + +对于二阶矩过程 $X(t), t \in \R$,若 $\forall t_1 \lt t_2 \le t_3 \lt t_4$,$t_1, t_2, t_3, t_4 \in \R$,满足 + +$$ +E(X(t_4) - X(t_3))(\overline{X(t_2) - X(t_1)}) = 0 +$$ + +则称 $X(t), t \in \R$ 为正交增量过程。 + +**独立增量过程** + +对于二阶矩过程 $X(t), t \in \R$,若 $\forall t_1 \lt t_2 \le t_3 \lt t_4$,$t_1, t_2, t_3, t_4 \in \R$,$X(t_4) - X(t_3)$ 和 $X(t_2) - X(t_1)$ 统计独立,则称为独立增量过程。 + +均值为0的独立增量过程是正交增量过程。 + +**平稳增量过程** + +对于随机过程 $X(t), t \in \R$,若 $X(t) - X(s)$ 的分布仅仅依赖于 $t - s$,则称为平稳增量过程。 + +定理: + +随机过程 $X(t), t \in [0, \infty]$,满足 $X(0) = 0$,则其为正交增量过程的充要条件为 + +$$ +R_X(s, t) = F(\min(s, t)) +$$ + +其中,$F(\cdot)$是单调不减的函数。 + +### 随机过程的极限、连续、导数、积分 + +**均方极限** + +$$ +E(|ka|^2) +$$ + + + +唯一性:若 $X_n \xrightarrow{m.s} X, X_n \xrightarrow{m.s}Y$,则 $E(|X - Y|^2) = 0$. + +可加性: + +数字特征相同: + +如何判定 ${X_n}$ 是否收敛? + +Cauchy 准则 + +$$ +X_n \xrightarrow{m.s}{X} \Leftrightarrow E(|X_m - X_n|^2) = 0, m, n \rightarrow \infty +$$ + +洛伊夫准则: + +$$ +X_n \xrightarrow{m.s} X \lrArr E\lbrace X_n X_m^*\rbrace \rightarrow \text{constant} +$$ + +**均方连续** + +二阶矩过程,$t \rightarrow t_0, X(t) \xrightarrow{m.s.} X(t_0)$,则称 $X(t)$ 在 $t_0$ 处连续 + +定理 + +以下命题等价: + +1. $R(t, s)$ 在 $(t_0, t_0)$ 上连续,$\forall t_0 \in T$ +2. $X(t)$ 在 $T$ 上均方连续 +3. $R(t, s)$ 在 $T \times T$ 上连续 + +推论 + +对于宽平稳过程 $X(t)$,$R(\tau)$ 为自相关函数,以下命题等价: + +1. $R(\tau)$ 在 $\tau = 0$ 处连续; +2. $X(t)$ 在 $T$ 上均方连续; +3. $R(\tau)$ 在 T 上连续。 + +**均方导数** + +若 $\frac{X(t_0 + h) - X(t_0)}{h}\xrightarrow{m.s.}Y(t_0), \forall t_0 \in T, h \rightarrow 0$,则称$\lbrace X(t) \rbrace$ 在均方意义下的导数为 $Y(t)$。 + +如何判断 $X(t)$ 是否均方可导? + +Cauchy 准则 + +$$ +E\left(|\frac{X(t_0 + h) - X(t_0)}{h} - \frac{X(t_0 + g) - X(t_0)}{g}|^2\right) \rightarrow 0, \forall h, g \rightarrow 0 +$$ + +洛伊夫准则 + +$$ +E\left(\left(\frac{X(t_0 + h) - X(t_0)}{h}\right)\left(\frac{X(t_0 + g) - X(t_0)}{g}\right)^*\right) \rightarrow 0, \forall h, g \rightarrow 0 +$$ + +均方导数判定定理 + +$$ +\frac{\partial^2 R(t, s)}{\partial t \partial s} 在 (t_0, t_0) 存在且连续,则 X(t) 在 t_0 处存在均方倒数 +$$ + +均方导数的性质: + +$f(t)$ 为线性函数 + +* $E(X^\prime(t)) = \frac{\mathrm d }{\mathrm dt} E(X(t))$ +* $E(X^\prime(t)\overline{X(s)}) =\frac{\partial }{\partial t}R_x(t, s)$ +* $E(X(t)\overline{X^\prime(s)}) =\frac{\partial }{\partial s}R_x(t, s)$ +* $E(X^\prime(t)\overline{X^\prime(s)}) =\frac{\partial^2 }{\partial t\partial s}R_x(t, s)$ + + +**均方积分** + +若黎曼和 $\sum\limits_{k=1}^{n}X(v_k)h(v_k)(t_k - t_{k - 1})$ 在 $n \rightarrow \infty, \max\lbrace t_k - t_{k - 1}\rbrace \rightarrow 0$ 时均方收敛,其中 $h(t)$ 为确定的可积函数,则称$\lbrace X(t)\rbrace$ 为均方可积,记为 $\int_{a}^{b}X(t)h(t)\mathrm dt$。 + +判定定理 + +$$ +\lbrace X(t)h(t) \rbrace 均方可积 \Leftrightarrow \int_{a}^{b}\int_{a}^{b}R_X(t, s)h(t)h^*(s)\mathrm dt\mathrm ds 存在 +$$ + +均方积分的性质: + +* $E\left( \int_{a}^{b}X(t)h(t)\mathrm dt\right) = \int_{a}^{b}E(X(t))h(t)\mathrm dt$ +* $E\left( \left(\int_{a}^{b}X(t)h(t)\mathrm dt\right)\left(\int_{a}^{b}X(s)h(s)\mathrm ds\right)^*\right) = \int_{a}^{b}E(X(t))h(t)\mathrm dt$ +* 三角不等式:$\sqrt{ E \left(|\int_{a}^{b}X(t)h(t)\mathrm dt|^2\right) } \le \int_{a}^{b}\sqrt{E\left(|X(t) - h(t)|^2\right)}\mathrm dt$ +* 均方积分与均方导数:$X(t)$ 在 $[a, b]$ 上均方连续,$Y(t) = \int_{a}^{t}X(s)\mathrm ds$,其中等号代表均方相等,则 $\lbrace Y(t)\rbrace$ 在 $[a, b]$ 可导,并称在均方意义下 $\lbrace Y(t) \rbrace$ 的导数为 $\lbrace X(t) \rbrace$ + +### 随机过程的遍历性 + +统计平均:对样本空间取平均 + +$$ +E\lbrace X(t_0) \rbrace = \int_{}^{}x\mathrm dF_X(x;t_0) +$$ + +时间平均: + +$$ +\langle X(t) \rangle = \frac{1}{T} \int_{-T/2}^{T/2}X(t)\mathrm dt +$$ + +统计平均和时间平均的关系? + +时间平均更容易获得。如果我们可以通过时间平均来获得统计平均? + +**遍历性** + + +定义-宽平稳过程均值遍历: + +$$ +\langle X(t) \rangle = \lim\limits_{T\rightarrow\infty} \frac{1}{2T} \int_{-T}^{T}X(t)\mathrm dt \mathop{=}\limits^{a.s.} E \lbrace X(t) \rbrace = \mu +$$ + +a.s. = with probability 1 + +左边是随机变量,右边是一个确定的数。这样的相等,意味着左边的随机变量的均值确定,方差为0. + +定义:宽平稳过程自相关遍历 + +$$ +\langle X(t + \tau)X^*(t) \rangle = \lim\limits_{T\rightarrow\infty} \frac{1}{2T} \int_{-T}^{T}X(t + \tau)X^*(t)\mathrm dt \mathop{=}\limits^{a.s.} R_X(\tau) = E \lbrace X(t + \tau)X^*(t)\rbrace +$$ + +a.s. = with probability 1 + +定理: + +宽平稳过程 $X(t)$ 满足均值遍历 $\lrArr$ + +$$ +D(\langle X(t) \rangle) = \lim\limits_{T \rightarrow\infty} \frac{1}{2T}\int_{-2T}^{2T}\left(1 - \frac{|\tau|}{2T}\right)(R_X(\tau) - |\mu|^2)\mathrm d\tau = 0 +$$ + +定理: + +宽平稳过程具有均值遍历性的充要条件是: + +$$ +\lim\limits_{T\rightarrow\infty} \frac{1}{2T}\int_{-T}^{T}C_X(\tau)\mathrm d\tau = 0 或者 \lim\limits_{T\rightarrow\infty} \frac{1}{T}\int_{0}^{T}C_X(\tau)\mathrm d\tau = 0 +$$ + +时间比较长的时候相关性消失了,也就是说过了一段时间同一轨道的样本就独立了,等价于多个轨道的样本,时间平均和统计平均就相等了。 + +2个推论: + +* 若实数宽平稳过程的协方差函数满足 $\int_{0}^{+\infty}C_x(\tau)\mathrm d\tau\lt +\infty$,则该过程具有均值遍历性 +* 若实数宽平稳过程的协方差函数满足 $C_x(\tau) \rightarrow 0, \tau \rightarrow +\infty$,则该过程具有均值遍历性 + +### 随机过程的线性展开 + +**卡胡曼-洛伊夫展开** + +在平方可积空间上 + +定义范数 + +定义内积,正交 + +在 $L^2[a, b]$ 中一定有一组标准正交基函数 $\phi_1(t), \phi_2(t), \phi_3(t)\dots$ 满足 + +$$ +\begin{cases} + \langle \phi_i, \phi_j \rangle = 0, i\ne j\\ + \langle \phi_i, \phi_i \rangle = 1 +\end{cases} +$$ + +* $f$ 可以用有限个基函数线性加和来逼近 +* $\langle f, \phi_n \rangle$ 表示 $f$ 在 $\phi_n$ 基上的坐标。 + +周期性宽平稳随机过程可以用傅里叶级数展开 + +$$ +E\left(\left |X(t) -\sum\limits_{n=-\infty}^{\infty}c_ne^{j\omega_0t} \right |^2\right) = 0 +$$ + +一般的用 KL 展开 + +随机向量的双正交展开: + +零均值的 $n$ 元随机向量 $\mathbf X \in R^n$ 可以如下展开: + +$$ +X = \sum\limits_{k=1}^{n} \xi_k \mathbf e_k +$$ + +基向量选择的是自相关矩阵 $\mathbf R$ 的特征向量。 + +如果我们用 $\mathbf K$ 个维度来逼近 $\mathbf X$,为了使得误差最小,选取最大的$\mathbf K$个特征值: $\mathbf X =\sum\limits_{k=1}^{K} \alpha_k\mathbf e_k$。这就是主成分分析(PCA)。 + +## 谱分析 + +### 周期函数的傅里叶级数 + +$$ +x(t) =\sum\limits_{n=-\infty}^{\infty}a_n e^{j\omega_0 t}, \omega_0 = \frac{2\pi}{T}\\ +a_n = \frac{1}{T}\int_{0}^{T}x(t)e^{-jn\omega_0t}\mathrm dt +$$ + +帕斯瓦尔定理 + +$$ +\frac{1}{T}\int_{0}^{T}|x(t)|^2\mathrm dt =\sum\limits_{n=-\infty}^{\infty}|a_n|^2 +$$ + +自相关函数 + +$$ +R(\tau) = \frac{1}{T}\int_{0}^{T}x(t + \tau)x^*(t)\mathrm dt +$$ + +功率谱密度 + +$$ +S(\omega) =\sum\limits_{n=-\infty}^{\infty}|a_n|^2\delta(\omega - n \omega_0) +$$ + +从而有 + +$$ +S(\omega) = \int_{-\infty}^{\infty}R(\tau)e^{-j\omega\tau}\mathrm d\tau +$$ + +### 非周期函数的傅里叶变换 + +#### 知识 + +$$ +F(\omega) = \int_{-\infty}^{\infty}x(t)\exp(-j\omega t)\mathrm dt\\ +x(t) = \frac{1}{2\pi}\int_{-\infty}^{\infty}F(\omega)\exp(j\omega t)\mathrm d\omega = \int_{-\infty}^{\infty}F(f)\exp(j2\pi ft)\mathrm df +$$ + +帕斯瓦尔定理 + +$$ +\int_{-\infty}^{\infty}|x(t)|^2\mathrm dt = \int_{-\infty}^{\infty}|F(f)|^2\mathrm df +$$ + +$$ +时域采样 \lrarr 频域周期延拓\\ +时域周期延拓 \lrarr 频域采样\\ +$$ + +自相关函数 + +$$ +R(\tau) = \int_{-\infty}^{\infty}x(t + \tau)x^*(t)\mathrm dt +$$ + +能量谱密度 + +$$ +S(\omega) = |F(\omega)|^2 = \left |\int_{-\infty}^{\infty}x(t)e^{j\omega t}\mathrm dt \right|^2\\ +$$ + +波赫纳尔——辛钦定理 + +$$ +S(\omega) = \int_{-\infty}^{\infty}R(\tau)e^{-j\omega\tau}\mathrm d\tau\\ +R(\tau) = \frac{1}{2\pi}\int_{-\infty}^{\infty}S(\omega)e^{j\omega\tau}\mathrm d\omega, S(\omega)\ge 0 +$$ + +实过程的 $S(\omega)$ 为偶函数。 + +离散随机过程的功率谱: + +只在整数点 k 采样 + +$$ +S(\omega) =\sum\limits_{k=-\infty}^{\infty}R(k)e^{-j\omega k}\\ +R(k) = \frac{1}{2\pi}\int_{-\pi}^{\pi}S(\omega)e^{j\omega k}\mathrm d\omega +$$ + +周期过程(自相关函数有周期性)的功率谱 + +$$ +S(\omega) =\sum\limits_{n=-\infty}^{\infty}b_n\delta(\omega - n \Delta \omega)\\ +R(\tau) = \frac{1}{2\pi}\sum\limits_{n=-\infty}^{\infty}b_ne^{jn\Delta\omega\tau} +$$ + +#### 例子 + +白噪声 $E \lbrace X(t) \rbrace = 0$, + +$$ +S(\omega) = N_0, -\infty \lt \omega \le \infty\\ +R(\tau) = N_0\delta(\tau) +$$ + +* 任意两个不同时刻 $X(t_1), X(t_2)$ 都不相关。 +* 在各个频率上都有分量,且强度一致。 + +高斯白噪声:各时刻服从高斯分布的白噪声 + +色噪声: $R(\tau)$ 不是冲击函数。 + +* 当某过程 $R(\tau)$ 比较胖的时候,功率谱比较瘦 + * 相隔较长时间 $X(t)$ 与 $X(t + \tau)$ 还相关,说明信号变化慢,对应频域低频多 +分量多 +* 当某过程 $R(\tau)$ 比较瘦时,功率谱比较胖 +* 相隔一点时间, $X(t)$ 与 $X(t + \tau)$ 不太相关,说明信号变化快,对应频域高频分量多。 + +互谱密度 + +$$ +S_{XY}(\omega) = \int_{-\infty}^{\infty}R_{XY}(\tau)e^{-j\omega \tau}\mathrm d\tau +$$ + +称为互谱密度,不具有功率的含义。 + +$$ +S_{YX}(\omega) = S_{XY}^*(\omega)\\ +R_{XY}(\tau) = 0, \forall \tau \lrArr S_{XY}(\omega) = 0, \forall \omega +$$ + +$$ +Z(t) = X(t) + Y(t)\\ +R_Z(\tau) = E \lbrace (X(t + \tau) + Y(t + \tau))\overline{(X(t) + Y(t))} \rbrace = R_X(\tau) + R_{XY}(\tau) + R_{XY} +$$ + +一个宽平稳过程分别通过两个 LTI 系统: + +$$ +Y_1(t) = X(t) * h_1(t)\\ +Y_2(t) = X(t) * h_2(t)\\ +R_{Y_1Y_2}(\tau) = R_X(\tau) * h_1(\tau) * h_2^*(-\tau)\\ +S_{Y_1Y_2}(\omega) = S_X(\omega)H_1(\omega)H_2^*(\omega)\\ +$$ + +两个过程输入两个系统,输出过程的互谱(互相关函数的傅里叶变换)。怎么求? + +(输入为联合宽平稳) + +$$ +\hat X(t) = X(t) * f(t)\\ +\hat Y(t) = Y(t) * g(t)\\ +R_{\hat X\hat Y}(\tau) = R_{XY}(\tau) * f(\tau) * g^*(-\tau)\\ +S_{\hat X\hat Y}(\omega) = S_{XY}(\omega)F(\omega)G^*(\omega) +$$ + + +### 宽平稳过程通过线性系统 + +$$ +Y(t) = \int_{-\infty}^{\infty}h(t - \tau)X(\tau)\mathrm d\tau +$$ + +总结: +* 输出过程的均值:易求,因为宽平稳过程的均值为常数 +* 输出过程的自相关函数:有点麻烦 + +首先看输出与输入的自相关 + +$$ +R_{YX}(\tau) = \int_{-\infty}^{\infty}h(v)R_x(\tau - v)\mathrm dv\\ +R_Y(\tau) = \int_{-\infty}^{\infty}h^*(-u)R_{YX}(\tau - u)\mathrm du +$$ + +$$ +R_Y(\tau) = R_X(\tau) * h(\tau) * h^*(-\tau)\\ +S_Y(\omega) = |H(\omega)|^2S_X(\omega) +$$ + +因此,输出的自相关,也可以用功率谱求解。 + +### 离散时间宽平稳序列 + +$$ +R_{YX}(k) = h(k) * R_X(k)\\ +R_Y(k) = h^*(-k) * h(k) * R_X(k)\\ +S_Y(z) = H(z) H^*(\frac{1}{z^*})S_X(z)\\ +其中 H(z) =\sum\limits_{}^{}h(k)z^{-k}\\ +令 z = e^{j\omega}\\ +S_Y(\omega) = |H(\omega)|^2S_X(\omega) +$$ + +理想白噪声通过低通滤波器: + +$$ +S_Y(f) = \begin{cases} + k_0, -f_c \le f \le f_c,\\ + 0, \text{otherwise.} +\end{cases}\\ +R_Y(0) = 2f_ck_0\\ +R(\tau) = R_Y(0)\frac{\sin(2\pi f_c\tau)}{2\pi f_c\tau} +$$ + +从自相关函数可看出,相隔 $\frac{n}{2f_c}$ 的两个时刻不相关。因此,以 $2f_c$ 为采样频率的噪声采样数据彼此不相关。 + +可以证明宽平稳过程功率谱非负:$S_X(f) \ge 0$: + +$$ +E \lbrace |Y(t)|^2 \rbrace = R_Y(0) = \int_{-\infty}^{\infty}S_Y(f)\mathrm df = \int_{-\infty}^{\infty}S_X(f)|H(f)|^2\mathrm df \ge 0 +$$ + +如果 $S_X(f)$ 在某个地方小于0,可以设计对应的滤波器 $H(f)$将这个小于0的区域滤出来,从而 $\int_{-\infty}^{\infty}S_X(f)|H(f)|^2\mathrm df \le 0$,导致矛盾。 + +线性系统例子: + +滑动平均 + +$$ +Y(t) = \frac{1}{T}\int_{t-T}^{t}X(s)\mathrm ds +$$ + +转化为滤波器: + +$$ +R_Y(t) = R_X(t) * h(t) * h^*(-t)\\ +h(t) = \begin{cases} + \frac{1}{T}, 0 \le t \le T,\\ + 0, \text{otherwise.} +\end{cases} +$$ + +令 + +$$ +g(t) = h(t) * h^*(t) = \begin{cases} + \frac{1}{T}\left ( 1 - \frac{|t|}{T} \right), t \in [-T, T],\\ + 0,\text{otherwise.} +\end{cases} +$$ + +理想的矩形窗 + +$$ +R_Y(t) = \int_{-\infty}^{\infty}g(t - \tau)R_X(\tau)\mathrm d\tau = \int_{-T}^{T}\frac{1}{T}\left ( 1 - \frac{|t - \tau|}{T} \right)R_X(\tau)\mathrm d\tau +$$ + +从频域看 + +$$ +H(\omega) = \text{sinc} \left ( \frac{\omega T}{2} \right)e^{-j\omega \frac{T}{2}}\\ +S_Y(\omega) = S_X(\omega)\left |\text{sinc} \left ( \frac{\omega T}{2} \right) \right|^2 +$$ + +是一个低通滤波器。 + +例子2:MTI 滤波 + +静止目标反射信号相同,运动目标反射回波不同。因此设计滤波器消去静止目标。称为“对消”。 + +$$ +Y(t) = X(t) - X(t - T) +$$ + +在频域看: + +$$ +H(\omega) = 1 - e^{j\omega T} +$$ + +静止目标,多普勒频率为0,因此频域响应为0;运动目标,多普勒频率不为0,频域响应不为0。因此这是一个高通滤波器。 + +还可以多次对消: + +$$ +Y_1(t) = X(t) - X(t - T)\\ +Y_2(t) = Y_1(t) - Y_1(t - T)\\ +Y_3(t) = Y_2(t) - Y_2(t - T)\\ +\vdots\\ +Y_n(t) = Y_{n - 1}(t) - Y_{n - 1}(t - T) +$$ + +频率响应: + +$$ +H(\omega) = (1 - e^{-j\omega T})^n +$$ + +### 采样定理 + +随机过程下的采样定理 + +$|f| \le f_0$, 当 $f_s \le 2f_0$ 时,均方意义下有 + +$$ +X(t) =\sum\limits_{k=-\infty}^{\infty}X(kT) \text{sinc} \left ( \frac{\pi}{T}(t - kT) \right) +$$ + +证明: + +$$ +\begin{align*} + &要证明 N \rightarrow \infty 时,\\ + &\varepsilon_N = E \left \lbrace \left | X(t) -\sum\limits_{k=-N}^{N}X(kT)\text{sinc} \left ( \frac{\pi}{T}(t - kT) \right) \right|^2 \right \rbrace \rightarrow 0\\ + &利用E \lbrace X(a) X^*(b) \rbrace = R_X(a - b) = \frac{1}{2\pi}\int_{-\infty}^{\infty}e^{j\omega a}e^{-j\omega b}S_X(\omega)\mathrm d\omega,展开上式\\ + &\varepsilon_N = \frac{1}{2\pi}\int_{-\infty}^{\infty}\left | e^{j\omega t} -\sum\limits_{k=-N}^{N}e^{j\omega kT}\text{sinc} \left ( \frac{\pi}{T}(t - kT) \right) \right|^2 S_X(\omega)\mathrm d\omega\\ + &= \frac{1}{2\pi}\int_{-\omega_s/2}^{\omega_s/2}\left | e^{j\omega t} -\sum\limits_{k=-N}^{N}e^{j\omega kT}\text{sinc} \left ( \frac{\pi}{T}(t - kT) \right) \right|^2 S_X(\omega)\mathrm d\omega\\ + &对 e^{j\omega t}做周期延拓,周期为 \omega_s,可以做频域傅里叶级数展开\\ + &e^{j\omega t} = \sum\limits_{k=-\infty}^{\infty}\alpha_k e^{j\omega \frac{2\pi}{\omega_s}} = \sum\limits_{k=-\infty}^{\infty}\alpha_k e^{j\omega kT}\\ + &\alpha_k = \frac{1}{\omega_s}\int_{-\omega_s/2}^{\omega_s/2}e^{j\omega t}e^{-j\omega kT}\mathrm d\omega = \frac{\sin(\frac{\omega}{2}(t - kT))}{\frac{\omega}{2}(t - kT)}\\ + &从而\left | e^{j\omega t} -\sum\limits_{k=-N}^{N}e^{j\omega kT}\text{sinc} \left ( \frac{\pi}{T}(t - kT) \right) \right|^2 = \left | e^{j\omega t} -\sum\limits_{k=-N}^{N}\alpha_k e^{j\omega kT}\right|^2 \rightarrow 0, N \rightarrow \infty +\end{align*} +$$ + +* 采样定理两边是均方相等。 +* 当满足采样定理时,离散点包含全部信息,任意取值点可以恢复。 +* 频带边界点 + * 当功率谱在 $\pm \omega_0$ 处有 $\delta$ 函数时,以 $f_s = 2f_0$ 无法恢复信号。 + * 例如:$X(t) = \cos(\omega_0 t + \phi)$,$\phi$ 为随机相位,在$[0, 2\pi]$内均匀分布。 + * $R(\tau) = \frac{1}{2}\cos(\omega_0\tau)$ + * $S(\omega) = \delta(\omega - \omega_0) + \delta(\omega + \omega_0)$ + * 采样点 $X(kT) = (-1)^kX(0)$,与 $X(0)$ 严重相关。 + +欠采样 + +$$ +\begin{align*} + E \lbrace |\varepsilon(t)|^2 \rbrace =& \int_{\omega_s/2}^{-\omega_s/2}\sum\limits_{n=-\infty}^{\infty}|1 - e^{jn\omega t}|S(\omega + n\omega_s)\mathrm d\omega\\ + =&\sum\limits_{n=-\infty}^{\infty}4\sin^2(\omega_snt/2) \cdot \int_{\omega_s/2}^{-\omega_s/2}S(\omega + n\omega_s)\mathrm d\omega\\ +\end{align*}\\ + +上面的级数为积分的加权求和。 n = 0 时权重为0,对应[-\omega_s/2, \omega_s/2] 内的功率谱。\\ +n\ne 0 时,权不为0,对应[-\omega_s/2, \omega_s/2]外的频谱,如果在这个区间外功率谱不是0,那 |\varepsilon|^2 将大于0。 + +$$ + +### 带通采样 + +$$ +X(\omega) = 0, |\omega - \omega_c| > \omega_0, |\omega + \omega_c| > \omega_0 +$$ + +一般研究实信号 $g(t)$,频谱具有共轭对称性,只需要考虑正半轴的频带就可以了: + +$$ +G(-\omega) = G^*(\omega)\\ +A(\omega) = A(-\omega), \varphi(-\omega) = -\varphi(\omega) +$$ + +希尔伯特变换: + +$$ +H(\omega) = \begin{cases} + -j, \omega \gt 0,\\ + 0, \omega = 0,\\ + j, \omega \lt 0. +\end{cases} +$$ + +$$ +\lbrace G(\omega)H(\omega) \rbrace^* = G(-\omega)H(-\omega) +$$ + +希尔伯特把正频率移相 $-90\degree$,负频率移相 $+90\degree$ + +时域表示: + +滤波器的时域响应为 + +$$ +\hat h(t) = \frac{1}{\pi t} +$$ + +g(t) 做两次希尔伯特变换,相位转了 $180\degree$: + +$$ +g(t)\xrightarrow{H(\omega)}\hat g(t) \xrightarrow{H(\omega)} -g(t) +$$ + +正交性: + +$$ +\int_{-\infty}^{\infty}g(t)\hat g(t)\mathrm dt = 0 +$$ + +看成$\hat g(t)$ 与 $g(-t)$ 的卷积: + +$$ +\int_{-\infty}^{\infty}g(t)\hat g(t)\mathrm dt = \int_{-\infty}^{\infty}g(- (u - t))\hat g(t)\mathrm dt|_{u = 0} = g(-t) * \hat g(t) |_{t = 0}\\ +g(-t) \rightarrow G^*(\omega) = G(-\omega), \hat g(t) \rightarrow G(\omega)H(\omega)\\ +g(-t) * \hat g(t)|_{t = 0} = \int_{-\infty}^{\infty}G^*(\omega)G(\omega)H(\omega)e^{j\omega t}\mathrm d\omega|_{t = 0} = 0 +$$ + +希尔伯特变换与原信号相加得到单边的频谱: + +$$ +g(t) \rightarrow A^* + A\\ +j\hat g(t) \rightarrow \\ +g(t) + j\hat g(t) \rightarrow 2A\\ +$$ + +下变频: + +$$ +\tilde{g}(t) = \lbrace g(t) + j\hat g(t) \rbrace e^{-j\omega_c t} = g_I(t) + jg_Q(t)\\ +g_I(t) = g(t) \cos \omega_c t + \hat g(t) \sin (\omega_c t)\\ +g_Q(t) = - g(t) \sin \omega_c t + \hat g(t) \cos (\omega_c t)\\ +$$ + +实际上是一个旋转矩阵,把单边频信号 $\tilde g(t)$ 顺时针旋转了 $\omega_ct$变成了基带复信号。 + +与原信号频谱的关系: + +$$ +g_I(t) \rightarrow G(f - f_c) + G(f + f_c) \\ +g_Q(t) \rightarrow G(f - f_c)(+j) + G(f + f_c)(-j)\\ +(f \le |f_0|) +$$ + +调制和解调的流程 +* 调制:不需要得到 $\hat g(t)$ +* 解调:通过低通滤波代替$\hat g(t)$ + +随机过程的希尔伯特变换 + +$X(t)$为实的带通随机过程 + +$$ +R_X(-\tau) = E\left \lbrace X(t - \tau)X^*(t) \right \rbrace = E\left \lbrace X(t)X^*(t + \tau) \right \rbrace = E\left \lbrace X(t + \tau)X(t) \right \rbrace = R_X(\tau)\\ +S_X(-\omega) = \int_{-\infty}^{\infty}R_X(\tau)e^{-j(-\omega) \tau}\mathrm d\tau = \int_{-\infty}^{\infty}R_X(-u)e^{-j\omega\tau}\mathrm du = \int_{-\infty}^{\infty}R_X(u)e^{-j\omega\tau}\mathrm du = S_X(\omega) +$$ + +通过希尔伯特滤波器后: + +$$ +\hat X(t) = X(t) * h(t)\\ +R_{\hat X}(\tau) = R_X(\tau) * h(t) * h^*(-t) = R_X(\tau)\\ +S_{\hat X}(\omega) = S_X(\omega)|H(\omega)|^2 = S_X(\omega) +$$ + +互相关: + +$$ +\hat R_X(\tau) = R_{\hat XX}(\tau) = E \left \lbrace \int_{-\infty}^{\infty}X(t + \tau - u)\frac{1}{\pi u}\mathrm duX(t) \right\rbrace = \int_{-\infty}^{\infty}R_X(\tau)\frac{1}{\pi u}\mathrm du +$$ + +$$ +R_{X\hat X}(\tau) = -\hat R_X(\tau) +$$ + +因此 + +$$ +Y = X + j\hat X\\ +R_Y(\tau) = R_X(\tau) + R_{\hat X}(\tau) + jR_{\hat XX}(\tau) - jR_{X\hat X}(\tau) = 2R_X(\tau) + 2j\hat R_X(\tau)\\ +S_Y(f) = \begin{cases} + 4S_X(f), &f \gt 0\\ + 0, &f\lt 0 +\end{cases} +$$ + +实的带通随机过程配合虚部的希尔伯特变换,同样也是只有正频率 + +反之,如果功率谱只有正频率有值,则实部和虚部互为希尔伯特变换,实部和虚部的信息是重复的。 + +随机信号的下变频: + +$$ +\tilde{X}(t) = \lbrace X(t) + j\hat X(t) \rbrace e^{-j\omega_c t} = X_I(t) + jX_Q(t)\\ +X_I(t) = X(t) \cos \omega_c t + \hat X(t) \sin (\omega_c t)\\ +X_Q(t) = - X(t) \sin \omega_c t + \hat X(t) \cos (\omega_c t)\\ +$$ + +同样是顺时针旋转了 $2\pi f_c t$ 之后得到了基带信号 + +研究基带信号的实部、虚部的统计特性 + +$\tilde{X}(t)$ 还是一个平稳过程 + +$$ +E \lbrace \tilde{X}(t) \rbrace = E \lbrace X_I(t) \rbrace = E \lbrace X_Q(t) \rbrace = 0\\ +R_{X_I}(\tau) = R_X(\tau)\cos(2\pi f_c\tau) + \hat R_X(\tau)\sin(2\pi f_c\tau)\\ +R_{X_Q}(\tau) = R_X(\tau)\cos(2\pi f_c\tau) + \hat R_X(\tau)\sin(2\pi f_c\tau)\\ +R_{X_I}(\tau) = R_{X_Q}(\tau)\\ +R_{X_Q}(0) = R_{X_I}(0) = R_{X}(0)(三者方差一样)\\ +\hat R_X(0) = 0(奇函数,不具备自相关函数的性质)\\ +S_{X_I}(f) = S_{X_Q}(f) = \begin{cases} + S_X(f - f_c) + S_X(f + f_c), &|f| \le f_0,\\ + 0, &\text{otherwise.} +\end{cases} +$$ + +基带信号虚部和实部的互相关 + +$$ +R_{X_IX_Q}(\tau) = R_X(\tau)\sin(2\pi f_c\tau) - \hat R_X(\tau)\cos (2\pi f_c\tau),奇函数 +$$ + +$$ +R_{X_IX_Q}(0) = 0 +$$ + +因此同一时刻实部和虚部不相关。 + +互谱密度 + +$$ +S_{X_IX_Q}(f) = \begin{cases} + jS_X(f + f_c) - jS_X(f - f_c), &|f| \lt f_0,\\ + 0, &\text{otherwise.} +\end{cases} +$$ + +只有当正频谱和负频谱分别跟 $f = \pm f_c$ 对称时,互谱密度恒为0。此时,任意两个时间的虚部和实部信号都是不相关的。 + +## 高斯过程 + +### 定义 + +随机向量$X = (X(t_1), \dots, X(t_n))^T$ 服从 $n$ 元高斯分布,称为高斯过程。 + +均值 $\mu_k$ = $E \lbrace X_k \rbrace$ + +协方差阵 + +$$ +\Sigma = E \lbrace (X - \mu)(X - \mu)^T \rbrace = \begin{bmatrix} + b_{11}& \dots &b_{1n}\\ + \vdots& \ddots & \vdots\\ + b_{n1} & \dots & b_{nn} +\end{bmatrix}\\ +b_{ij} = E \lbrace (X_i - \mu_i)(X_j - \mu_j)^T \rbrace\\ +b_{ij} = b_{ji}^* = b_{ji} +$$ + +做特征分解 + +$$ +\Sigma v_i = \lambda_i v_i\\ +Q = (v_1, v_2, \dots, v_n)正交阵, Q^{-1} = Q^T\\ +\Sigma = Q\text{diag}(\lambda_1, \dots, \lambda_n)Q^T\\ +\Sigma^{-1} = Q^T\text{diag}(\lambda_1^{-1}, \dots, \lambda_n^{-1})Q +$$ + +### 多元高斯分布 + +$$ +f(x) = K \cdot \exp \left \lbrace -\frac{1}{2}(x - \mu)\Sigma^{-1}(x - \mu)^T \right \rbrace +$$ + +线性变换以消去下标$ij$项: + +$$ +\Sigma^{-1} = A^TA\\ +y = A(x - \mu)\\ +(x - \mu)\Sigma^{-1}(x - \mu)^T = y^Ty +$$ + +$$ +1 = K \int \dots \int \exp \left \lbrace -\frac{1}{2}(x - \mu)\Sigma^{-1}(x - \mu)^T \right \rbrace \mathrm dx_1 \dots \mathrm dx_n\\ +K = \frac{1}{(\sqrt{2\pi})^n\cdot \sqrt{|\Sigma|}} +$$ + +多元高斯矢量的特征函数 + +$$ +\omega = (\omega_1, \omega_2,\dots, \omega_n)^T\\ +\Phi_X(\omega) = E \lbrace e^{j\omega^TX} \rbrace = E \lbrace e^{j(\omega_1 X_1 + \omega_2 X_2 + \dots + \omega_n X_n)} \rbrace = \exp \left \lbrace j\omega^T\mu - \frac{1}{2}\omega^T\Sigma\omega \right \rbrace +$$ + +特征函数不要求 $\Sigma$ 可逆。概率密度函数要求 $\Sigma$ 正定,特征值都大于0. + +当 $X$ 为高斯矢量时 + +$$ +\Phi_X(\omega) = \int_{}^{}\int_{}^{}\dots\int_{}^{} K \cdot \exp \left \lbrace -\frac{1}{2}(x - \mu)^T\Sigma^{-1}(x - \mu) \right \rbrace\mathrm dx_1\mathrm dx_2\dots\mathrm dx_n = \int_{}^{}\int_{}^{}\dots\int_{}^{} K \cdot \exp \left \lbrace -\frac{y^Ty}{2} \right \rbrace \sqrt{|\Sigma|} +$$ + +高斯白噪声的协方差矩阵只有对角元,对角元为方差。 + +可以用逼近处理 $|\Sigma| = 0$: + +$$ +\Sigma_K = \Sigma + \frac{1}{K}I\\ +\Phi_X(\omega) = \exp \left \lbrace j\omega^T\mu - \frac{1}{2}\omega^T \left (\Sigma + \frac{1}{K}I \right)\omega \right \rbrace\\ +f(x) = \frac{1}{\sqrt{2\pi}^n \sqrt{|\Sigma_K|}} \cdot \exp \left \lbrace -\frac{1}{2}(x - \mu)\Sigma^{-1}(x - \mu)^T \right \rbrace +$$ + +然后再讨论 $K \rightarrow \infty$ 的情况。 + +多元高斯矢量的边缘分布 + +任取子矢量 $\lbrace K_1, K_2, \dots, K_m \rbrace \subseteq {1, 2, \dots, n}$ + +观察 $\tilde{ X} = (X_{K_1}, X_{K_2}, \dots, X_{K_m})^T$ 的分布 + +$$ +\tilde{\Phi}(\tilde\omega) = E \lbrace e^{j(\omega_{K_1}\tilde X_{K_1} + \omega_{K_2}\tilde X_{K_2} + \dots + \omega_{K_m}\tilde X_{K_m})} \rbrace = \exp \left \lbrace j\tilde\omega^T\mu - \frac{1}{2}\tilde\omega^T\Sigma\tilde\omega \right \rbrace +$$ + +用置换矩阵 $P$ 将 $\Sigma$ 的第 $K_1, K_2, \dots, K_m$ 行、列移到 $\Sigma$ 的左上角,对应的 $\omega$ 也置换: + +$$ +P\omega = \begin{pmatrix} + \tilde{\omega}\\ + 0 +\end{pmatrix}\\ +P^T\Sigma P^T = \begin{pmatrix} + \tilde{\Sigma} & B\\ + C & D +\end{pmatrix} +$$ + +置换到左上角后,容易看出子矢量的特征函数可以通过将原矢量其他的$\omega$置零得到,均值就是选择对应的均值,协方差矩阵就是把对应的行列元素抽出来: + +$$ +\omega^T\Sigma\omega = (\tilde{\omega}, 0)^T\begin{pmatrix} + \tilde{\Sigma} & B\\ + C & D +\end{pmatrix}\begin{pmatrix} + \tilde{\omega}\\ + 0 +\end{pmatrix} = \tilde{\omega}^T\tilde{\Sigma}\tilde{\omega} +$$ + +利用特征函数求数字特征: + +$$ +\frac{\partial^2\Phi}{\partial \omega_k\partial \omega_l}|_{\omega_k = \omega_l = 0} = -(\mu_l\mu_k + b_{kl})\\ +E \lbrace X_kX_l \rbrace = \mu_l\mu_k + b_{kl} +$$ + +$$ +E \lbrace X_1^{k_1}\dots X_n^{k_n} \rbrace = j^{\sum\limits_{i=1}^{n}k_i} \frac{\partial^{k_1 + k_2 + \dots k_n}}{\partial^{k_1}\omega_1\partial^{k_2}\omega_2\dots \partial^{k_n}\omega_n}\bigg|_{\omega_1 = \omega_2 = \dots = \omega_n = 0} +$$ + +高斯的矢量分布的高阶矩完全由一阶矩 $\mu$ 和二阶矩 $\Sigma$ 决定。例如可以用特征函数推出: + +$$ +\begin{align*} + &E \left \lbrace X_1X_2X_3X_4 \right \rbrace \\ + =& j^4 \frac{\partial^4\Phi}{\partial \omega_1\partial \omega_2\partial \omega_3\partial \omega_4}\bigg|_{\omega_1 = \omega_2 = \omega_3 = \omega_4 = 0} \\ + =& E \left \lbrace X_1X_2 \right \rbrace E \left \lbrace X_3X_4 \right \rbrace + E \left \lbrace X_1X_3 \right \rbrace E \left \lbrace X_2X_4 \right \rbrace + E \left \lbrace X_1X_4 \right \rbrace E \left \lbrace X_2X_3 \right \rbrace +\end{align*} +$$ + +独立性 + +独立性说的是统计,不相关说的是线性(二阶矩) + +一般来说 + +$$ +独立 \Rightarrow 不相关\\ +不相关 \not \Rightarrow 独立 +$$ + +但是,对于高斯分布而言: + +$$ +独立 \lrArr 不相关 +$$ + +这是因为高斯分布完全由一阶和二阶矩决定。 + +定理: + +$n$ 元向量 $X = \binom{X_1}{X_2}$ 服从 $N(\mu, \Sigma)$,则 $X_1, X_2$ 独立 $\lrArr$ $\Sigma_{12} = 0$ + +$$ +\Sigma = \begin{pmatrix} + \Sigma_{11}&\Sigma_{12}\\ + \Sigma_{21}&\Sigma_{22} +\end{pmatrix} +$$ + +充分性: + +$$ +\Sigma_{12} = E \left \lbrace (X_1 - \mu_1)^T(X_2 - \mu_2) \right \rbrace = E \left \lbrace (X_1 - \mu_1)\right\rbrace E\left \lbrace(X_2 - \mu_2) \right \rbrace = 0 +$$ + +必要性: + +$$ +f(x_1, x_2) = \frac{1}{(2\pi)^{n/2}\sqrt{|\Sigma|}}\exp \left \lbrace -\frac{1}{2}\begin{pmatrix} + x_1 - \mu_1\\ + x_2 - \mu_2 +\end{pmatrix}^T\begin{pmatrix} + \Sigma_{11}&0\\ + 0&\Sigma_{22} +\end{pmatrix} \begin{pmatrix} + x_1 - \mu_1\\ + x_2 - \mu_2 +\end{pmatrix} \right \rbrace = f(x_1)f(x_2) +$$ + +可见 $X_1, X_2$ 统计独立。 + +对于高斯过程: + +$$ +严平稳 \lrArr 宽平稳 +$$ + +即 $X(t_1), X(t_2), \dots, X(t_n)$ 和 $X(t_1 + \tau), X(t_2 + \tau), \dots, X(t_n + \tau)$ 有相同的 $\mu, \Sigma$ 等价于具有相同的分布函数。 + +线性变换 + +定理: $X$ 服从高斯分布,矩阵 $C_{m\times n}$, $Y = CX$,则 $Y$ 服从高斯分布 $N \left(C\mu, C \Sigma C^T \right)$。 + +高斯过程经过微分,积分,滤波等线性操作,输出还是高斯过程。 + +有一种重要的线性变换:去相关。 + +$$ +\Sigma_X = \begin{pmatrix} + \Sigma_{11}&\Sigma_{12}\\ + \Sigma_{21}&\Sigma_{22} +\end{pmatrix}\\ +Y = \begin{pmatrix} + Y_1\\Y_2 +\end{pmatrix}= \begin{pmatrix} + I & A\\ + 0 & I +\end{pmatrix}\begin{pmatrix} + X_1\\X_2 +\end{pmatrix}\\ +E \left \lbrace (Y_1 - E(Y_1))(Y_2 - E(Y_2))^T \right \rbrace = \Sigma_{12} + A\Sigma_{22 } = 0 +$$ + +需要 + +$$ +-\Sigma_{12}\Sigma_{22}^{-1} = A\\ +$$ + +计算协方差 + +$$ +E \left \lbrace (Y - E(Y))(Y - E(Y))^T \right \rbrace = \begin{pmatrix} + \Sigma_{11} - \Sigma_{12}\Sigma_{22}^{-1}\Sigma_{21}&0\\ + 0&\Sigma_{22} +\end{pmatrix} +$$ + +去相关之后方差减小了。可以认为 $X_1 = Y_1 - AX_2$ 中,$- AX_2$是与 $Y$ “独立” 的“噪声项”,这个噪声导致了 $X_1$ 的方差大于去相关之后的 $Y$ 的方差。 + +去相关与是否是高斯矢量无关。但是对于高斯矢量,去相关之后,两个矢量就独立了,具有重要的意义。 + +对于一般的二阶矩过程,希望找到一个矩阵 $U$ ,使得 $Y = UX$ 的各个分量不相关: + +$$ +E \left \lbrace (Y - \mu_Y)(Y - \mu_Y)^T \right \rbrace = \text{diag}\\ +E \left \lbrace U(X - \mu_X)(X - \mu_X)^TU^T \right \rbrace = \text{diag} = U\Sigma U^T +$$ + +所以,本质上就是分析了协方差矩阵 $\Sigma$ 的特征值。也就是二阶矩章节讲到的主成分分析: + +$$ +\text{diag}(\lambda_1, \dots, \lambda_n) +$$ + +选取 $\lambda_i$ 大的特征矢量,张成主成分空间。 + +信号处理中有信号空间(特征值大的)和噪声空间(特征值小的,被噪声掩盖了)。 + +有时候 $Y$ 的各个分量不相关还不能完全消去元素之间的统计关系。只是线性不相关。不相关的约束实际上很弱。 + +如果要设计 $U$,使得 $Y = UX$ 的各个分量独立,运算很复杂。 + +但是,对于高斯矢量而言,不相关就是独立。所以对于高斯过程,主成分分析 $\lrArr$ 独立成分分析。 + +### 高斯变量的条件分布 + +仍是高斯: + +$$ +f_{X_1|X_2}(x_1|x_2) = \frac{1}{\sqrt{\tilde{\Sigma}_{11}}(2\pi)^{\frac{n_1}{2}}}\exp \left \lbrace -\frac{1}{2}(x_1 - \tilde{\mu}_1)^T\tilde{\Sigma}_{11}^{-1}(x_1 - \tilde{\mu}_1) \right\rbrace\\ +E \lbrace X_1 | X_2 \rbrace = \mu_1 + \Sigma_{12}\Sigma_{22}^{-1}(X_2 - \mu_2)\\ +E \lbrace (X_1 - E(X_1 | X_2))(X_1 - E(X_1|X_2))^T|X_2 \rbrace = \Sigma_{11} - \Sigma_{12}\Sigma_{22}^{-1}\Sigma_{21} +$$ + +### 实高斯过程的若干性质 + +实高斯过程完全由均值函数和协方差函数确定。 + +严平稳等价于宽平稳。 + +若实高斯过程均方可导,则 $\lbrace X^\prime(t) \rbrace$ 也是高斯过程。 + +高斯过程通过一般线性系统仍然是高斯过程。 + +$$ +Y(t) = \int_{a}^{b}X(\tau)h(t, \tau)\mathrm d\tau\\ +更强的结论:\left \lbrace \binom{X(t)}{Y(t)} \right \rbrace 是高斯过程。 +$$ + +### 零均值带通高斯过程 + +$$ +Z(t) = X(t) + j \hat X(t)\\ +X_B(t) = X_I(t) + j X_Q(t)\\ +V(t) = \sqrt{X_I^2(t) + X_Q^2(t)}\\ +\Theta(t) = \arctan \frac{X_Q(t)}{X_I(t)}\\ +$$ + +此时有 + +$$ +X(t) = V(t)\cos(\omega_ct + \Theta(t))\\ +\binom{X_I(t)}{X_Q(t)} = \binom{\ \ \ \cos(\omega_ct)\quad \sin(\omega_c t)}{-\sin(\omega_ct)\quad \cos(\omega_ct)}\binom{X(t)}{\hat X(t)} +$$ + +幅度为瑞利分布,相位为均匀分布,相互统计独立: + +$$ +f_V(v) = \frac{v}{\sigma^2}e^{-\frac{v^2}{2\sigma^2}}, v \ge 0\\ +f_\Theta(\theta) = \frac{1}{2\pi}, \theta \in [0, 2\pi] +$$ + +### 随机相位正弦波信号叠加零均值带通高斯 + +$$ +Y(t) = A\sin(\omega_ct + \Phi) + X(t) +$$ + +结果是幅度为莱斯分布,相位均匀分布,二者统计独立: + +$$ +f_{V(t)}(v) = \frac{v}{\sigma^2}\exp(-\frac{v^2 + A^2}{2\sigma^2})I_0(\frac{Av}{\sigma^2})\\ +f_\Theta(\theta) = \frac{1}{2\pi} +$$ + +### 高斯过程经过非线性函数 + +限幅器 + +$$ +h(x) = \begin{cases} + 1, x\ge 0,\\ + 0, x \lt 0 +\end{cases} +$$ + +服从两点分布 + +$$ +P(Y(t) = 1) = P(Y(t) = 0) = \frac{1}{2}\\ +E_Y(t) = 0\\ +R_Y(t, s) = P \lbrace X(t)X(s) \ge 0 \rbrace - P \lbrace X(t)X(s) \lt 0 \rbrace +$$ + +$$ +P \lbrace X(t)X(s) \ge 0 \rbrace = \int_{0}^{\infty}\int_{0}^{\infty}\frac{1}{2\pi\sqrt{|\Sigma|^{-1}}}\exp((x_1\ x_2)\Sigma^{-1}\binom{x_1}{x_2})\mathrm dx_2\mathrm dx_1 = \frac{\pi/2 + \sin^{-1}(-\rho)}{2\pi} +$$ + +全线性检波(求绝对值) + +$$ +E(Y) = \frac{2\sigma}{2\pi}\int_{0}^{\infty}\frac{y}{\sigma^2}\exp(-\frac{y^2}{2\sigma^2})\mathrm dy = \sqrt{\frac{2}{\pi}}\sigma\\ +R_Y(t, s) E \lbrace |X(t)||X(s)| \rbrace = \frac{2\sigma^2}{\pi} \lbrace \sqrt{1 - \rho^2} + \rho\sin^{-1}\rho \rbrace, \rho = \frac{R_X(t - s)}{\sigma^2}\\ +\int_{0}^{\infty}\int_{0}^{\infty}x_1x_2\frac{1}{2\pi\sigma^2\sqrt{1 - \rho^2}}\exp(-\frac{x_1^2 - 2\rho x_1x_2 + x_2^2}{2\sigma(1 - \rho^2)})\mathrm dx_1\mathrm dx_2 +$$ + +半波线性检波 + +$$ +h(x) = \begin{cases} + x, x\ge 0,\\ + 0, x\lt 0 +\end{cases} +$$ + +$$ +R_Y(t, s) = \frac{\sigma^2}{\pi} \lbrace \sqrt{1 - \rho^2} + \rho\sin^{-1}\rho \rbrace\\ +$$ + +平方率检波 + +$$ +h(x) = x^2 +$$ + +$$ +P(Y(t) \le y) = P(-\sqrt{y} \le Y(t) \le \sqrt{y}) = 2\Phi(\frac{\sqrt{y}}{\sigma}) - 1\\ +f_Y(y) = \frac{1}{\sqrt{2\pi}\sigma}\frac{1}{\sqrt{y}}\exp \lbrace -\frac{y}{2\sigma^2} \rbrace,\ (y \gt 0)\\ +E \lbrace Y(t) \rbrace = \sigma^2\\ +R_Y(t,s) = E \lbrace X^2(t_1)X^2(t_2) \rbrace = \sigma^2 + \sigma^2 + \rho\sigma^2 + \rho\sigma^2 = 2(\rho + 1)\sigma^2 +$$ + +基带信号的包络经过平方律检波 + +$$ +X_I^2 + X_Q^2 = V^2 服从复指数分布 +$$ + +### 高斯——马尔可夫性 + +马尔可夫特性: + +$$ +f(x_n|x_1, \dots, x_{n - 1}) = f(x_n|x_{n - 1}) +$$ + +如果一个过程既是高斯的,又是马尔可夫的,会有很好的性质。 + +对于零均值高斯分布: + +$$ +X(t) 是 \text{Markov} \lrArr R(t_1, t_3) = \frac{R(t_1, t_2)R(t_2, t_3)}{R(t_2, t_2)} +$$ + +正向很好证明,反向证明的关键是计算均值和方差。 + +$$ +X(t) 是 \text{Markov} \lrArr \forall t_1\le t_2\le...\le t_n, E \lbrace X_n|X_1, X_2, \dots, X_{n - 1} \rbrace = E \lbrace X_n|X_{n - 1} \rbrace +$$ + +从右到左:条件协方差 $E\lbrace (Y_1 - E \lbrace Y_1|Y_2 \rbrace)^2|Y_2\rbrace = \Sigma_{11} - \Sigma_{12}\Sigma_{22}^{-1}\Sigma_{21}$ 跟 $Y_2$ 无关(这并不是说条件协方差和协方差具有相同的意义,只是数值上正好相等) + +$$ +E(X_n|X_{n - 1}) = \frac{E(X_nX_{n - 1})}{E(X_{n - 1}^2)}X_{n - 1}\\ +$$ + +残差与已有信息正交: + +$$ +E \lbrace [X_n - E(X_n | X_{n - 1})] \cdot X_k \rbrace = 0, k = 1, 2, \dots, n - 1\\ +$$ + +类似于最小二乘估计: + +$$ +X_n - \alpha_n X_{n - 1} 是一个高斯过程,与 X_1, X_2, \dots, X_n 独立 +$$ + +自回归方程: + +$$ +X_n = \alpha_n X_{n - 1} + \beta_nY_n\\ +Y_n \sim N(0, 1) +$$ + +### Brown 运动 + +从一维随机游走开始: + +$$ +P \lbrace X_i = a \rbrace = P \lbrace X_i = -a \rbrace = \frac{1}{2}\\ +Y =\sum\limits_{i=1}^{\infty}X_i +$$ + +令 $t = nT$,固定 $t$,令 $n \rightarrow \infty$,由 CLT 可知成为一个高斯分布: + +$$ +E(Y) = 0\\ +D(Y) = \frac{t}{T}a^2\\ +\frac{a^2}{T} = \beta\\ +f_Y(y) = \frac{1}{\sqrt{2\pi}\sqrt{\beta t}}\exp (-\frac{y^2}{2\beta t}) +$$ + +随着时间增加,不确定性越来越大。 + +标准布朗运动: + +(1)$B(t)$ 满足独立增量,平稳增量 +(2)$B(t)$ 的每个样本轨道都是连续的 +(3)$\forall t, B(t)$ 遵循高斯分布,均值0,方差 $t$ + +$$ +f_t(x) = \frac{1}{\sqrt{2\pi t}}\exp (-\frac{x^2}{2t}) +$$ + +布朗运动是高斯白噪声的积分: + +$$ +Y(t) = \int_{0}^{t}X(u)\mathrm du +$$ + +可见布朗运动的不规则。 + +## Markov 过程 + +### Markov 链 + +一种状态离散、时间离散的随机过程。 + +### Markov 特性 + + + +马尔可夫特性的一种表示: + +在已知现在的条件下,过去与将来独立。 + +$$ +P(C,A | B) = P(C | B, A) \cdot P(A|B) = P(C|B)P(A|B) +$$ + +其他表示:过去用集合事件表示 + +$$ +P \lbrace X_{n+1}=j|(X_{n-1}, \dots, X_1)\in A, X_n=i \rbrace = P \lbrace X_{n+1}=j|X_n=i \rbrace +$$ + +进一步,过去是一个集合,未来也是一个集合: + +$$ +P \lbrace X_{n+1}\in B|(X_{n-1}, \dots, X_1)\in A, X_n=i \rbrace = P \lbrace X_{n+1}\in B|X_n=i \rbrace +$$ + +但是,变量“现在”必须取值为一个确定的值,不能是一个集合。对现在的状态一定要精确掌握,不能放宽约束。 + +口号:从小事做起(泊松),从现在做起(马尔可夫) + +转移概率 + +$$ +P_{ij}(m, n) = P \lbrace X_n = a_j | X_m = a_i \rbrace +$$ + +$$ +P_{ij}(m, n) \ge 0\\ +\sum\limits_{j}^{}P_{ij}(m, n) = 1 +$$ + +一步转移概率: + +$$ +P_{ij}(m, m + 1) 或 P_{ij}(m) +$$ + +状态转移矩阵 + +观察变量族的联合分布 + +### 齐次马尔科夫链的迭代表示 + +$$ +X_0 \xrightarrow{Z_1} X_1 \xrightarrow{Z_2} X_2 \dots \xrightarrow{Z_n} X_{n} +$$ + +$$ +X_{n+1} = f(X_n,Z_{n+1}) = P \lbrace X_{n+1} = j | X_n = i \rbrace +$$ + +也称为新息过程 + +### 一维随机游走 + +吸收壁 + +反射壁 - 完全反射壁 + +成功逃跑 + +等待服务人数 + +$$ +X_{n + 1} = \begin{cases} + X_n - 1 + Y_{n + 1}, X_n \ne 0\\ + Y_{n + 1}, X_0 +\end{cases}\\ +P = \begin{bmatrix} + a_0 & a_1 & a_2 & \dots\\ + a_0 & a_1 & a_2 & \dots\\ + & a_0 & a_1 & \dots\\ + & & a_0 & \dotsb +\end{bmatrix} +$$ + +### 柯尔莫格洛夫方程 + +多步转移矩阵概率 + +$$ +P_{ij}(m, n) = \sum_k P(X_n = j | X_r = k) \cdot P(X_r = k | X_m = i) +$$ + +或者表示为 + +$$ +P_{ij}^{(p + q)} = \sum_{k \in \Omega} P_{ik}^{(p)} P_{kj}^{(q)} +$$ + +由于上面转移阵步数 $p, q$ 的任意性,多步跳变矩阵可以转变为矩阵相乘: + +$$ +P^{(L)} = P^{(L - 1)}P^{(1)} = ... = P^L +$$ + +求多步转移矩阵:适用于齐次马尔可夫 + +齐次马尔可夫链的 $P$ 与时间起点无关 + +先求 $P^{(n)} = P^n$,再看 $[P^n]_{ij}$ 就是要求的转移概率。 + +如何求 $P^n$ ? + +首先做特征分解 $PU = U\Lambda$ + +$$ +P^n = U \Lambda^nU^{-1} +$$ + +二元通信信道 + +$$ +P = \begin{pmatrix} + 1 - \alpha & \alpha\\ + \beta & 1 - \beta +\end{pmatrix}\\ +U = \begin{pmatrix} + 1 & -\alpha\\ + 1 & \beta +\end{pmatrix} +$$ + + +$$ +P^n = \frac{(1 - \alpha - \beta)^n}{\alpha + \beta}\begin{pmatrix} + \alpha & -\alpha\\ + -\beta & \beta +\end{pmatrix} + \frac{1}{\alpha + \beta} \begin{pmatrix} + \beta & \alpha\\ + \beta & \alpha +\end{pmatrix} +$$ + +在 $|1 - \alpha - \beta| < 1$ 的条件下,无穷步跳变后: + +$$ +P^n = \frac{1}{\alpha + \beta} \begin{pmatrix} + \beta & \alpha\\ + \beta & \alpha +\end{pmatrix} +$$ + +各列相等,说明这个马尔可夫链与初始状态无关,历史被淡忘——马尔可夫性。 + + +$1 - \alpha - \beta = -1$ 时,极限不存在 + +$$ +P = \begin{pmatrix} + 0 & 1\\ + 1 & 0\\ +\end{pmatrix} +$$ + +### 状态分类 + +可达性:$\exists m, s.t. P_{ij}^{(m)} > 0$ + +互通性:$\exist m, n, s.t. P_{ij}^{(m)} > 0, P_{ji}^{(n)} > 0$,是等价关系。 + +不可约(irreducible),不可分 + +马尔可夫链中每两个状态都是互通的,也叫互通链。 + +闭集:$\forall i \in C, j\not \in C, i \not \rightarrow j$ + +不可约的另一定义:除了把整个链作为闭集,不存在取其中一些状态构成其他闭集了。 + +激励状态 + +稳定状态(闭集) + +一般情况,Markov 链的转移矩阵行列重排后可化为: + +$$ +P = \begin{pmatrix} + u_1\\ + &u_2\\ + &&\ddots\\ + &&&u_k\\ + v_1&v_2&\dots&v_k&v_{k+1} +\end{pmatrix} +$$ + +对闭集而言,可以在闭集内使用柯尔莫格洛夫方程: + +$$ +P_{ij}^{(n + m)} =\sum\limits_{r\in \Omega_1}^{}P_{ir}^{(n)}P_{rj}^{(m)} +$$ + +首次达到时间:$T_{ij}(\omega) = \min \lbrace n: X_0(\omega) = i, X_n(\omega) = j, n \ge 1 \rbrace$ + +$$ +T_{ij} \in [1, 2, ..., \infty) +$$ + +首次到达概率 + +$$ +f_{ij}^{(n)} = P \lbrace T_{ij} = n| X_0 = i \rbrace +$$ + +此时有 +$$ +f_{ij}^{(1)} = P_{ij} +$$ + +定义 + +$$ +f_{ij} =\sum\limits_{k=1}^{\infty^-} f_{ij}^{(k)} +$$ + +为迟早到达的概率。 + +$$ +f_{ij}^{(\infty)} = 1 - f_{ij} +$$ + +表示永远无法到达的概率。 + +定理: + +$$ +P_{ij}^{(n)} =\sum\limits_{r=1}^{n} f_{ij}^{(r)}P_{jj}^{(n - r)} +$$ + +考虑 $P_{ij}^{(0)} = \delta_{ij}$,上述可以写成卷积形式: + +$$ +F_{ij}(z) = \sum\limits_{r=0}^{\infty} f_{ij}^{(r)}z^r\\ +G_{ij}(z) = \sum\limits_{r=0}^{\infty} f_{ij}^{(r)}z^{r}\\ +G_{ij}(z) = \delta_{ij} + F_{ij}(z)G_{jj}(z) +$$ + +$$ +i \rightarrow j \lrArr f_{ij} \gt 0 +$$ + +### 常返性 + +#### 常返与非常返 + +若 $f_{ij} = 1$,称状态 i 为常返态 + +令 $z = 1$: + +$$ +G_{ij}(1) = \delta_{ij} + F_{ij}(1)G_{jj}(1)\\ +i = j \rArr G_{ii}(1) = \frac{1}{1 - F_{ii}(1)} \rArr \sum_{n = 0}^{\infty}P_{ii}^{(n)} = \frac{1}{1 - f_{ii}} +$$ + +常返性判别: + +$$ +常返态 \lrArr f_{ii} = 1 \lrArr \sum\limits_{n=0}^{\infty}P_{ii}^{(n)} = +\infty\\ +非常返态 \lrArr f_{ii} \lt 1 \lrArr \sum\limits_{n=0}^{\infty}P_{ii}^{(n)} = \frac{1}{1 - f_{ii}} < +\infty\\ +$$ + +后面会证明,这种返回的次数都是无穷大。 + +常返的理解: + +$$ +\forall n, A_n = \begin{cases} + A_n = 1, X_n = i,\\ + A_n = 0, X_n \ne i. +\end{cases} +$$ + +$$ +E \lbrace \sum\limits_{k=0}^{\infty}A_k | X_0 = i \rbrace = \sum\limits_{k=0}^{\infty}P_{ii}^{(0)}\\ +$$ + +从判别定理可以看出,在期望意义上,常返态被无限次访问。 + +推论1:既然常返态被无穷次返回,非常返态被有限次访问,则在有限状态的 Markov 链中一定存在常返态。 + +反证法:如果全是有限返回次数,那所有态的访问次数加起来还是有限的,但是马尔可夫可以访问无限次,矛盾。所以一定有常返态。 + +推论1.1:如果非常返态的个数有限,则足够长的时间后,状态一定会到达常返态。 + +推论1.2:若 j 非常返,则$\forall i$ + +$$ +\sum\limits_{n=0}^{\infty}P_{ij}^{(n)} < \infty (i 到达 j的次数为有限值)\\ +\lim_{n \rightarrow \infty} P_{ij}^{(n)} = 0 +$$ + +推论2:若 $i$ 常返,$i \lrarr j$,则 $j$ 也是常返的。 + +推论3:若 $i$ 为常返,$i \rarr j$,则 $j \rarr i$ + +#### 正常返与零常返 + +$f_{ii}^n$ 可以视为首次返回时间 $T_{ii}$ 的概率分布。对于非常返态不能这么看,因为 $f_{ii} < 1$。 + +对于常返态的 $T_{ii}$,可以计算期望 + +$$ +\mu_i = E \lbrace T_{ii} \rbrace = \sum\limits_{n = 1}^{\infty} n f_{ii}^{(n)} +$$ + +若均值为无穷大,则称为零常返。 + +零常返与非常返是有区别的。零常返是可以常返,只是大概率步数很多。 + +定义返回的速率,可推导 + +$$ +\lim _{n \rightarrow \infty} \frac{1}{n} \sum\limits_ {k=0}^{n - 1} P_{jj}^{(k)} = \frac{1}{\mu_j} +$$ + +正常返意味着速率为常数,零常返意味着速率为 0。 + +判定定理: + +$$ +j 状态零常返 \lrArr \sum\limits_{n=0}^{\infty}P_{jj}^{(n)} = \infty, 且 n \rightarrow \infty 时,P_{jj}^{(n)} = 0 +$$ + +条件一就是常返的判定定理。条件二比较特殊: + +$$ +\lim_{n \rightarrow \infty}P_{jj}^{(n)} = \frac{1}{\mu_j} +$$ + +如果是零常返,这个极限就是0。在条件二上,零常返和非常返是一样的。 + +定理:常返态 $i$,$i \rarr j$,则 $i, j$ 同为正常返或者零常返 + +#### 补充性质 + +$$ +q_{jj}(M) = P \lbrace \sum\limits_{k=0}^{\infty}A_k \ge M | X_0 = j \rbrace\\ +\lim_{M \rarr \infty}q_{jj}(M) = \begin{cases} + 1, f_{jj} = 1\\ + 0, f_{jj} < 1\\ +\end{cases} +$$ + +下面研究常返态 $j$,不可约链 + +“从常返态触发,返回次数为无穷大”这件事的概率为 1. + +$$ +\lim_{M \rarr \infty} q_{rj}(M) = 1, \forall +$$ + +“任意状态访问常返态的次数为无穷大”的概率为1. + +$$ +q_{ij}(M) = f_{ij}q_{jj}(M) +$$ + +两边取极限可得 $f_{ij} = 1$ + +结论3: 从不可约链任何状态出发,迟早访问状态 $j$ + +$$ +\lim_{n \rarr \infty} P_{ij}^{(n)} = \frac{1}{\mu_j} +$$ + +结论4:极限概率与初始状态无关。 + +分类方式 + +对于每个常返态 i,存在一个 i 可达状态构成的状态集 C 。则这些状态彼此相通,构成一个不可约闭集,都常返 + +马尔可夫链可以唯一划分为 $C_1, C_2, ..., T$,其中 $C_i$ 互为不相交的不可约闭集。T 为非常返态。每个闭集中,常返类型一致,不同闭集不互通。 + +定理:马尔科夫链若有一个零常返,有无穷多个零常返。 + +推论:有限状态马尔可夫链的常返态必然为正常返。 + +#### 马尔可夫链的平稳分布和极限概率 + +对于不可约链: + +$$ +\lim_{n \rarr \infty}P_{ij}^{(n)} = 0,j非常返\\ +P_{ij}^{(n)} = \frac{1}{\mu_j} = 0,j零常返\\ +P_{ij}^{(n)} = \frac{1}{\mu_j},j正常返 +$$ + +极限概率用 $\pi_j$表示 + +对于非常返和零常返,极限概率都是0。零常返的链一定有无穷个状态。 + +对于正常返,$\pi_j \gt 0, \sum\limits_{j\in S}^{}\pi_j = 1$ + +从柯式方程得出: + +$$ +\pi_j = \sum\limits_{i}^{}\pi_iP_{ij} +$$ + +矩阵形式: +$$ +\lim_{n \rarr \infty} P^n = \Pi = \begin{bmatrix} + \pi_1 & \pi_2 & \cdots & \pi_n & \cdots\\ + \pi_1 & \pi_2 & \cdots & \pi_n & \cdots\\ + \cdots & \cdots & \cdots & \cdots & \cdots\\ +\end{bmatrix} +$$ + + +## 泊松过程 + +### 定义 + +#### 计数过程 + +在 $[0, t]$ 内发生某类事件的次数记为 $\lbrace N(t), t\ge 0 \rbrace$,则称 $\lbrace N(t) \rbrace$ 为计数过程。 + +#### 泊松过程 + +若满足以下条件: + +1. $N(0) = 0$ +2. 非负性:$N(t)$ 的取值非负整数; +3. 非降性:$N(t)$ 是随时间单调不减的; +4. 独立增量性:对于 $0 \le t_1 < t_2 < \ldots < t_n$,$N(t_2) - N(t_1), N(t_3) - N(t_2), \ldots, N(t_n) - N(t_{n-1})$ 是相互独立的随机变量; +5. 平稳增量性:对于 $0 \le s < t$,$N(t) - N(s)$ 的分布只与时间间隔 $t-s$ 有关,而与具体的时刻 $s$ 无关。 +6. $P(N(t + \Delta t) - N(t) = 1) = \lambda\Delta t + o(\Delta t), P(N(t + \Delta t) - N(t) \ge 2) = o(\Delta t)$ +则称 $\lbrace N(t), t\ge 0 \rbrace$ 为泊松过程。 + +### 性质 + +泊松的表达式 + +$$ +P_n(t) = P(N(t) = n) = \frac{(\lambda t)^n}{n!}e^{-\lambda t} +$$ + +泊松分布的特征函数 + +$$ +\phi_{N(t)}(\omega) = \exp \left \lbrace \lambda t (e^{j\omega} - 1) \right \rbrace +$$ + +泊松过程的数字特征 + +$$ +E(N(t)) = \lambda t\\ +R(t_1, t_2) = \lambda t_1 + \lambda^2 (t_1t_2) (t_1 \le t_2)\\ +C(t_1, t_2) = \min \lbrace t_1, t_2 \rbrace +$$ + +### 泊松与二项分布 + +泊松分布是二项分布的极限。 + +泊松脉冲串: + +$$ +X(t) = \frac{\mathrm dN(t)}{\mathrm dt} = \sum\limits_{i}^{}\delta(t - t_i)\\ +E(X(t)) = \lambda +$$ + +### 泊松相关问题 + +#### 事件间隔时间的分布 + +$S_n$ 表示第 n 件事到达的时刻 + +$T_n$ 表示相邻两件事发生的间隔 + +$$ +P\lbrace S_n \gt t \rbrace = P \lbrace N(t) \le n - 1 \rbrace +$$ + +$$ +f_{T_n}(t) = \lambda e^{-\lambda t}\\ +E(T_n) = 1 / \lambda +$$ + +$T_n$ 和 $T_m$ 是独立的。 + +#### 等待时间的分布 + +概率密度函数与特征函数互为傅里叶变换 + +$$ +\Phi_{T_i}(\omega) = \frac{\lambda}{\lambda - j\omega}\\ +\Phi_{S_n}(\omega) = \left (\frac{\lambda}{\lambda - j\omega} \right)^n\\ +$$ + +要求 $S_n$ 的概率密度函数,可以看作 $T_n$ 的卷积: + +$$ +f_{S_n}(t) = \frac{(\lambda t)^{n - 1}}{(n - 1)!}\lambda e^{-\lambda t}\\ +$$ + +称为 $\Gamma$ 分布,参数 $\lambda, n$。 + +#### 相邻两次事件之间的计数 + +两次公交车到来(速度 $\mu$)之间,等车人数(速度 $\lambda$)的计数: + +$$ +P(L = k) = (\frac{\mu}{\mu + \lambda})(\frac{\lambda}{\mu + \lambda})^k +$$ + +#### n个事件到达时间的的联合分布 + +$$ +f_{S_1...S_n|N(t) = n}(u_1, u_2, ..., u_n) = \frac{n!}{t^n} +$$ + +如果是有编号的(不是按顺序到达): + +$$ +f_{V_1...V_n|N(t) = n}(t_1, t_2, ..., t_n) = \frac{1}{t^n} +$$ + +以下分布的极限,就是泊松过程: + +$$ +P \lbrace N(s) = k | N(t) = n \rbrace = \binom{n}{k}(\frac{\lambda s}{n})^k(1 - \frac{\lambda s}{n})^{n - k} +$$ + +#### 总结泊松过程的几种定义 + +1. N(0) = 0,独立增量,平稳增量,$\Delta t$ 内发生一个事件的概率 $\lambda \Delta t$,发生两件事以上的概率小 +2. 事件时间间隔独立同分布,服从复指数分布,则计数为泊松 +3. N 个客体随机地分布在 $[0, t]$ 区间上,每个客体的出现时间均匀分布,且相互时间独立,当 $n \rightarrow \infty, t \rightarrow \infty$,极限分布为泊松分布 +4. 二项分布的极限 + +### 顺序统计量 + +统计量是样本的某个函数 $g(X_1, ..., X_n)$。例如:最大值、中值、平均值、样本协方差阵 + +顺序统计量:根据到达时刻排序。例如 $S_1, S_2, ..., S_n$ 就是 $V_1, V_2, ..., V_n$ 的顺序统计量 + +$$ +f_{Y_k}(x) = \binom{n}{k - 1}F(x)\binom{n - k + 1}{1}f(x)(1 - F(x))^{n - k} +$$ + +有序的顺序统计量的分布: + +$$ +f_{Y_1...Y_n}(y_1, y_2, ..., y_n) = n!f(y_1)f(y_2)...f(y_n) +$$ + +### 非齐次泊松过程 + +四个条件: + +$N(0) = 0$ + +$N(t)$ 独立增量 + +$P(N(t + \Delta t) - N(t) = 1) = \lambda(t)\Delta t + o(\Delta t)$ + +$P(N(t + \Delta t) - N(t) \ge 2) = o(\Delta t)$ + +定理: + +$$ +P(N(t_0 + t) - N(t_0) = n) = \frac{[m(t_0 + t) - m(t_0)]^n}{n!}e^{-[m(t_0 + t) - m(t_0)]} +$$ + +其中, + +$$ +m(t) = \int_{0}^{t}\mathrm \lambda(u) du +$$ + +其意义可以理解为事件的个数。 + +令 $m(t + t_0) - m(t_0) = \alpha$ + +$$ +P(N(t_0 + t) - N(t_0) = n) = \frac{\alpha^n}{n!}e^{-\alpha} +$$ + +则期望和方差 + +$$ +E(N(t_0 + t) - N(t_0)) = \alpha\\ +V(N(t_0 + t) - N(t_0)) = \alpha +$$ + +### 复合泊松 + +$Y_n$ 随机变量族,$N(t)$ 泊松过程,称$X(t) = \sum_{n = 1}^{N(t)}Y_n$ 为复合泊松。 + +$$ +E \lbrace X(t) \rbrace = \lambda t \cdot E \lbrace Y_i \rbrace\\ +D \lbrace X(t) \rbrace = \lambda t \cdot E \lbrace Y_i^2 \rbrace\\ +G_X(z) = \exp(\lambda t G_Y(z) - 1)\\ +\phi_X(\omega) = \exp(\lambda t \phi_Y(\omega) - 1) +$$ + +### 随机参数泊松 + +参数 $\lambda$ 是随机变量,PDF为 $f(\lambda)$ + +* 是平稳增量 +* 不是独立增量 + +$$ +P(Y(t) = n) = \int^{+\infty}_{0}\frac{(\lambda t)^n}{n!}e^{-\lambda t}f(\lambda)\mathrm d\lambda +$$ + +母函数: + +$$ +G_{Y(t)}(z) = \int_{0}^{\infty}\exp (\lambda t(z - 1))f(\lambda)\mathrm d\lambda +$$ + +$$ +E(Y(t)) = \int_{0}^{\infty}\lambda t f(\lambda)\mathrm d\lambda\\ +V(Y(t)) = \int_{0}^{\infty}\lambda t f(\lambda)\mathrm d\lambda\\ +$$ + +数据统计的后验分布 + +$$ +P(\Lambda \le x | Y(t) = n) = \frac{\int_{0}^{x}\frac{(\lambda t)^n}{n!}e^{-\lambda t}f(\lambda)\mathrm d\lambda}{\int_{0}^{\infty}\frac{(\lambda t)^n}{n!}e^{-\lambda t}f(\lambda)\mathrm d\lambda}\\ +f_\Lambda(x|Y(t) = n) = \frac{\frac{(x t)^n}{n!}e^{-x t}f(x)}{\int_{0}^{\infty}\frac{(\lambda t)^n}{n!}e^{-\lambda t}f(\lambda)\mathrm d\lambda} +$$ + +### 过滤的泊松过程 + +统计一段时间影响的总和 + +$$ +Y(t) = \sum\limits_{i=1}^{N(t)}h(t, S_i, A_i) +$$ + +特征函数: + +$$ +\Phi_{Y(t)}(\omega) = \exp \left ( \lambda t \left ( \int_{0}^{t}\frac{1}{t}\exp(j\omega h(t, v))\mathrm dv - 1\right) \right) +$$ + +均值: + +$$ +E(Y(t)) = \frac{1}{j}\frac{\partial \Phi_{Y(t)}}{\partial \omega} = \underbrace{\lambda t}_{平均到达个数} \underbrace{\int_{0}^{t}\frac{1}{t}\exp(j\omega h(t, v))\mathrm dv}_{每个事件在 t 时刻的影响} +$$ + +## 生灭过程 + +该过程状态可以用整数序列 $n = 0, 1, 2, 3, ...$ 来表示 + +状态转移只能发生在临近状态之间 + +在$[t, t + \Delta t)$ 区间内,n状态转移到 $n + 1$ 状态的概率为 $\lambda \Delta t$, 转移到 $n - 1$ 状态的概率为 $\mu \Delta t$。 + +### M/M/1 + +系统平均顾客人数 $L = \frac{\lambda / \mu}{1 - \lambda / \mu}$ + +排队平均人数 + +$$ +L_Q = \sum\limits_{n=1}^{\infty}(n - 1)p_n = \frac{\lambda^2}{(\mu - \lambda)\mu}\\ +L_Q \ne L - 1 +$$ + +前面有一个人,等待时间:负指数分布的无记忆性 + +$$ +f_T(t|T > t_0) = \mu e^{-\mu (t - t_0)} +$$ + +从而不管你什么时候来,平均等待时间为 $1/\mu$,和一个人被服务的时间是一样的。 + +## 习题课 + +![alt](../images/stochastic/exer_1.jpg) + diff --git a/blitherboom-blog/pages/posts/cpp-multi-file.md b/blitherboom-blog/pages/posts/cpp-multi-file.md new file mode 100644 index 00000000..6edd7c16 --- /dev/null +++ b/blitherboom-blog/pages/posts/cpp-multi-file.md @@ -0,0 +1,312 @@ +--- +title: 使用VSCode进行c++/c多文件开发 +date: 2022-09-02 20:51:41 +tags: +--- +## 前言 +vscode是个非常优秀的跨平台编辑器,尤其在Linux上更为常用。在vscode上进行c++语言的编译、运行和调试已经有了很多教程,但是使用vscode进行多文件的c++编译、调试的教程却相对难找。以下整理出一个在VScode上搭建C++/C开发环境的全过程。 +## 原理 +在Linux上进行c++的多文件编译,主要依靠的是GNU的Makefile,使用make命令进行编译。而makefile的可读性差、语法复杂、跨平台性差等问题又催生了可以在多平台运行、语法简洁的CMake,用来自动生成Makefile。 + +CMake是一个语法简单的跨平台编译工具。只要编写CMakeLists.txt文件,然后使用cmake命令,就可以根据不同的平台生成合适的Makefile文件,再利用make命令即可编译文件。 + +问题是,Makefile是Linux的编译工具,怎么在Windows平台上使用呢?毫无疑问可以使用WSL,在Linux子系统中进行c++项目开发。 + +但是在Windows上使用Makefile也不是没有可能,只要安装GNU在Windows上的移植版——mingw就行了。MinGW中的mingw64-make即为Linux中的make。 +## 实操 +### 前置工作 +没下载MinGW就去下一个。用处很多。 + +然后下载CMake。 + +Linux: `sudo apt-get install make` + +Windows: 上官网下最新版。 + +### 配置CMakeLists.txt +首先将文件夹设置为项目名称。 + +然后在项目文件夹下添加CMakeLists.txt: + +~~~CMake +# CMakeLists.txt +# cmake最低版本号要求 +cmake_minimum_required (VERSION 3.0) +# # 设置指定的C++编译器版本是必须的,如果不设置,或者为OFF,则指定版本不可用时,会使用上一版本。 +# set(CMAKE_CXX_STANDARD_REQUIRED ON) +# # 指定为C++03 版本 +# set(CMAKE_CXX_STANDARD 03) + +# 设置gdb为调试工具 +# 构建模式设置为Debug +SET(CMAKE_BUILD_TYPE "Debug") +# 调试时使用gdb +SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb") +# 发布时使用优化(1~3) +SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall") + +# 获取当前文件夹名称 +string(REGEX REPLACE ".*/\(.*\)" "\\1" CURDIR ${CMAKE_CURRENT_SOURCE_DIR}) +# 设置PROJECT_NAME变量 +set(PROJECT_NAME ${CURDIR}) +# 设置工程名 +project (${PROJECT_NAME}) +# 查找./src目录下的所有源文件并存入DIR_SRCS变量 +aux_source_directory(src DIR_SRCS) +# 添加一个可编译的目标到工程 +add_executable (${PROJECT_NAME} ${DIR_SRCS}) +# 从./include中添加静态库, 必须写在add_executable之后 +target_include_directories(${PROJECT_NAME} PUBLIC ./include) +message("PROJECT_NAME: ${PROJECT_NAME}") +message("CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}") +message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") +~~~ + +从上面的配置中可以分析出:源文件应该写在`./src`文件夹下,而头文件应该写在`./include`文件夹下。也可以改成其他目录。 + +代码什么意思在注释中写得很明白了,想要实现更多功能,可以上网查找CMake教程。 + +### tasks.json配置--CMake构建,Makefile编译 +在/.vscode下添加tasks.json: +~~~json +{ + "tasks": [ + { + "label": "CMake", + "detail": "运行CMake", + "type": "shell", + "command": "CMake", + "args": [ + "-G \"MinGW Makefiles\"", //这个参数指定CMake在mingw下使用makefile进行构建,如果去掉则使用默认的vs进行构建 + "..", + ], + "options": { + "cwd": "build" + }, + "group": "build", + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared", + "showReuseMessage": true, + "clear": true + }, + "problemMatcher": "$msCompile", + "dependsOn": [ + "MkBuild" + ] + }, + + { + "label": "MkBuild", + "detail": "建立build文件夹", + "type": "shell", + "command": "mkdir", + "args": [ + "-p", + "build" + ], + "windows": { + "args": [ + "-Force", + "build" + ] + }, + "group": "build", + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared", + "showReuseMessage": true, + "clear": true + }, + "problemMatcher": "$msCompile" + }, + + { + "label": "Make", + "detail": "使用Makefile编译", + "type": "shell", + "command": "mingw32-make", + "args": [ + ], + "options": { + "cwd": "build" + }, + "group": "build", + "presentation": { + "reveal": "always", + "clear": true + }, + "problemMatcher": "$msCompile", + }, + + { + "label": "Compile", + "detail": "仅编译。使用CMake --build编译,根据操作系统选择合适的编译器", + "type": "shell", + "command": "CMake --build .", + "options": { + "cwd": "build" + }, + "group": "build", + "presentation": { + "reveal": "always", + "clear": true + }, + "problemMatcher": "$msCompile", + }, + + { + "label": "Run", + "detail": "编译并运行程序", + "type": "shell", + "command": "start", + "args": [ + "./${workspaceFolderBasename}.exe" + ], + "group": "build", + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared", + "showReuseMessage": true, + "clear": true + }, + "options": { + "cwd": "build" + }, + "windows": { + "options": { + "cwd": "build" //exe文件所在的目录 + } + }, + "problemMatcher": "$msCompile", + "dependsOn": [ + "Compile" + ] + }, + { + "label": "CMake and Run", + "detail": "创建Makefile, 编译并运行程序", + "type": "shell", + "group": "build", + "dependsOn": [ + "CMake", + "Run" + ], + "dependsOrder": "sequence" + }, + { + "label": "CMake and Make", + "detail": "创建Makefile, 并编译", + "type": "shell", + "group": "build", + "dependsOn": [ + "CMake", + "Make" + ], + "dependsOrder": "sequence" + }, + ], + "version": "2.0.0" +} +~~~ +这里面定义了一大堆Task,有的是编译并运行,有的是仅编译,有的是仅调用cmake,有的是调用CMake和make,使用时按下`Ctrl + Shift + B`选择合适的task, 看下中文解释就行。 + +唯一需要解释的一个Task就是MkBuild。MkBuild实际上就是执行`mkdir -p build`。会创建一个叫做build的文件夹。项目的中间文件和最后的可执行文件都会生成在这个文件夹里。后面调试时的文件路径也依赖于build文件夹。 + +推荐使用CMake and Make进行编译,使用Run进行运行。可以设置task的快捷键,参考网上资料。 + +注意:按照CMake在原理中的描述,它仅仅是作为生成Makefile文件的工具使用,但是如果运行`cmake . --build`,CMake就可以不依赖Makefile,自己寻找合适的编译器进行编译。Tasks中的Compile就是这样。此时CMake会根据平台自动选择合适的编译器。在Linux的平台上,CMake会选择g++, make等工具。而在Windows平台上, CMake大概率是不知道你安装了MinGW的,它会选择微软著名的编译器Visual Studio进行编译,还会顺带生成一个Visual Studio解决方案方便你调试。不过我既然都生成Visual Studio的C++工程了,直接用Visual Studio开发不是更香吗(笑)。 + +至此已经可以进行编译。 + +### launch.json配置--gdb断点调试项目 + +新建launch.json: + +~~~json +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Debug", //名称 + "type": "cppdbg", //调试类型,除使用msvc进行调试外,均为该类型 + "request": "launch", + "program": "${workspaceFolder}/build/${workspaceFolderBasename}", //指定C/C++程序位置 + "args": [], //指定运行参数 + "stopAtEntry": false, + "cwd": "${workspaceFolder}/build", //指定工作目录 + "preLaunchTask": "CMake and Make", //在调试前会先调用这个task编译构建程序 + "environment": [], + "externalConsole": true, + "osx": { //macOS的特定配置 + // "miDebuggerPath": "/Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi", //修改使用的lldb-mi,一般不需要修改 + "MIMode": "lldb" //指定使用lldb进行调试 + }, + "linux": { //linux的特定配置 + "MIMode": "gdb", //指定使用gdb调试 + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + }, + "windows": { + "MIMode": "gdb", //指定使用gdb调试 + "miDebuggerPath": "C:/mingw64/bin/gdb.exe", //指定gdb的路径 + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + } + ] +} +~~~ + +默认调试按键是`F5`。打上断点,按下`F5`,系统自动运行CMake and Make编译程序。会有点慢。 + +注意:在CMakeLists.txt中有三句话: + +`SET(CMAKE_BUILD_TYPE "Debug")` + +`SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb")` + +`SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")` + +分别是:项目构建方式设置为调试模式(如果是Release则是发布模式)、调试时使用gdb、发布时使用3级优化(有0~3级)。 + +至此可以进行调试。 + +## tasks.json内容解释 + +待更新。 + +## 更进一步 + +手动配置文件虽然自由度高,但是还是挺麻烦。VSCode给我自动推荐了一个CMake插件叫做CMake Tools,好像也挺好用的,不知道后续能不能用插件一键生成多文件项目。 + +Tasks中的功能有点多了。之后尝试简化,方便使用。 + +gdb调试有个问题,就是长时间挂在一边不动,或者在监视窗口贸然输入一个变量进行监视时就有可能突然停止调试,错误信息闪了一下就消失了。稳定性还不行,原因未知。 + +这些配置还没有在Linux平台上尝试,可能需要进一步的测试和完善。 + +## 参考资料 + +[使用VSCode和CMake构建跨平台的C/C++开发环境](https://www.cnblogs.com/iwiniwin/p/13705456.html) + +[cmake gdb 编译调试详解](https://zhuanlan.zhihu.com/p/410219342) \ No newline at end of file diff --git a/blitherboom-blog/pages/posts/github-command.md b/blitherboom-blog/pages/posts/github-command.md new file mode 100644 index 00000000..19ec2ddf --- /dev/null +++ b/blitherboom-blog/pages/posts/github-command.md @@ -0,0 +1,62 @@ +--- +title: github的一些命令 +date: 2022-09-28 15:46:08 +tags: +--- + +# 如何删除某些提交? + +## 删除最新的提交 +`git reset --hard HEAD^` + +可以删除最新的一次提交。若要删除多次提交,可以在HEAD后多加几个^。 + +## 删除/合并中间的某次提交 +`git rebase -i ` + +填写要删除的提交的**之前**的那次提交的id。 + +之后会打开一个vim界面,显示 + +```bash +pick aaa +pick bbb +pick ccc +# Rebase xxx onto xxx (xxx command) +# +# Commands: +# p, pick = use commit +# r, reword = use commit, but edit the commit message +# e, edit = use commit, but stop for amending +# s, squash = use commit, but meld into previous commit +# f, fixup [-C | -c] = like "squash" but keep only the previous +# commit's log message, unless -C is used, in which case +# keep only this commit's message; -c is same as -C but +# opens the editor +# x, exec = run command (the rest of the line) using shell +# b, break = stop here (continue rebase later with 'git rebase --continue') +# d, drop = remove commit +# l, label