Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-2000.
조회 수: 1 (최근 30일)
이전 댓글 표시
Please help me solve this issue.
clc
close all;
clear all;
b01 = 0.011 ; % Density of 1state/1time
b02 = 0.001; % Density of 2state/1time
t = 2000; % Number of time steps
s = 100; % Number of states
b01(t) = b01 + gamma(t);
b02(t) = b02 + gamma(t); % State changing depend on time
b = b01 + b02; % Density of state changing
t/dis;
for j = 1 : s
L(j) = j-1;
end
% Determination of startvector
p = zeros(s,1);
p(1) = 0;
p(2) = 0.0006;
p(3) = 0.0024;
p(4) = 0.0079;
p(5) = 0.0224;
p(6) = 0.0540;
p(7) = 0.1109;
p(8) = 0.1942;
p(9) = 0.2897;
p(10) = 0.3683;
p(11) = 0.3989;
p(12) = 0.3683;
p(13) = 0.2897;
p(14) = 0.1942;
p(15) = 0.1109;
p(16) = 0.0540;
p(17) = 0.0224;
p(18) = 0.0079;
p(19) = 0.0024;
p(20) = 0.0006;
p(21) = 0;
% Determination of Markov matrix
R = zeros(s,s);
for i = 1 : s-2
R(i,i) = 1-b;
R(i+1,i) = b01;
R(i+2,i) = b02;
end
댓글 수: 1
Rik
2022년 5월 11일
I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer.
채택된 답변
Torsten
2022년 5월 9일
Setting
b01(t) = b01 + gamma(t);
b02(t) = b02 + gamma(t);
b = b01 + b02;
makes b01, b02 and b to arrays of size 1x2000 since t = 2000.
So the assignments
R(i,i) = 1-b;
R(i+1,i) = b01;
R(i+2,i) = b02;
don't work.
One remark: Don't name arrays min or max - these are internal MATLAB functions.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!