墨爾本代寫-線上編程學術專家

墨尔本代写assignment,加拿大美国论文代写,北美essay代写-Panda ScholarBest代寫-最專業靠譜代寫IT | CS | 留學生作業 | 編程代寫Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代寫

Matlab代寫 | Maths 162 Semester 2, 2020 Assignment 6: Graphs and Markov Chains

Matlab代寫 | Maths 162 Semester 2, 2020 Assignment 6: Graphs and Markov Chains

這個作業是用Matlab完成圖相關的數學計算

Maths 162 Semester 2, 2020
Assignment 6: Graphs and Markov Chains

Problems
1. Let G be a graph. If you use G.Edges, MATLAB will give you a list of all of the edges in G:
>> G = randgraph(3,0.5);
>> G.Edges
ans =
2×1 table
EndNodes
1 3
2 3
Tables are surprisingly annoying to work with, however. Consider the following code, which
you would think is a reasonable way to ask for the first edge in G.Edges:
>> G.Edges(1)
Error using graph/subsref (line 27)
Subscripting into a table using one subscript (as in t(i)) or three or more
subscripts (as in t(i,j,k)) is not supported. Always specify a row subscript and a
variable subscript, as in t(rows,vars).
A good fix for this is to convert things into an array, which we’re more used to working with:
>> arrayofedges = table2array(G.Edges)
arrayofedges =
1 3
2 3
>> arrayofedges(1,1)
ans = 1
>> arrayofedges(1,2)
ans = 3
With this in mind, create a MATLAB function validcolour(G) that takes in as input a
graph G that has a property G.Nodes.Colour defined. It should go through all of the edges
of G, and for each edge {x, y} check whether the two endpoints of that edge have the same
colours or not (i.e. whether G.Nodes.Colour(x) == G.Nodes.Colour(y)).
If all of the edges have differently-coloured endpoints, then validcolour(G) should return 1;
otherwise, it should return 0.
2. In MATLAB, you can make your programs deliberately produce errors with the error(msg)
command. When you run this command, the string given by msg will appear in red, you’ll hear
the classic error “boing” sound effect, and MATLAB will stop trying to execute any future
lines of code.
1
>> error(‘behold, a custom error message’)
behold, a custom error message
>> error(‘behold, a custom error message with variables in: %d’, 23)
behold, a custom error message with variables in: 23
This can be useful if you want to ensure that someone can only use your function if they’ve
given it a reasonable input. You’re going to do this here!
Specifically, you’re going to create a MATLAB function called markov(A,i,j,s). It takes
in as inputs a matrix A that is supposed to be a n × n transition matrix for some Markov
chain, as well as values i and j that are supposed to be states in this Markov chain (i.e. values
1 . . . n.)

Essay_Cheery

評論已關閉。

在線客服

售前咨詢
售后咨詢
微信號
Essay_Cheery
微信
北美代写,论文Essay代写,留学作业代写,-北美最专业的代写专家 堪培拉代写assignment,论文代写,留学作业代写-peaking代写 essay代写,assignment代写,留学生作业代写网课代做-锐 泽 代写 阿德莱德代写assignment,北美网课代修领导者,留学生网课代修代考 珀斯代写assignment,CS代写,留学生CS程序代写-Custom Writing代写 新西兰代写,math代写,新西兰Assignment代写-美 伦 代写 怎么样? 留学生CS代写,Java编程代写,网课代上代修-ezace留学生代写 达尔文代写assignment,留学生作业代写,留学代写-菠萝 菠萝蜜 代写 代写assignment,网课代上代考,考试代考论文代写-全球最好的华人代写机构 留学生代写,经济代写,代写作业-【靠谱】服务澳洲加拿大英国美国等地区