Skip to content

Instantly share code, notes, and snippets.

@johntfoster
Created November 3, 2015 04:09
Show Gist options
  • Select an option

  • Save johntfoster/fdc3997c0bc0b24f9daf to your computer and use it in GitHub Desktop.

Select an option

Save johntfoster/fdc3997c0bc0b24f9daf to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"ke =\n",
"\n",
" 2 1\n",
" 2 2"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ke = randi(2,2)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"con =\n",
"\n",
" 1 4\n",
" 2 3"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"con = [1 4; 2 3]"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"K =\n",
"\n",
" 2 0 0 1\n",
" 0 0 0 0\n",
" 0 0 0 0\n",
" 2 0 0 2"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"K = zeros(4,4);\n",
"K(con(1,:), con(1,:)) = K(con(1,:), con(1,:)) + ke"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Matlab",
"language": "matlab",
"name": "matlab_kernel"
},
"language_info": {
"codemirror_mode": "Octave",
"file_extension": ".m",
"help_links": [
{
"text": "MetaKernel Magics",
"url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
}
],
"mimetype": "text/x-matlab",
"name": "octave"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment