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 visualizzazione (ultimi 30 giorni)
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
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 Commento
Rik
Rik il 11 Mag 2022
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.
This page is now archived on the Wayback Machine.

Accedi per commentare.

Risposta accettata

Torsten
Torsten il 9 Mag 2022
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.
  14 Commenti
Maddy
Maddy il 25 Set 2022
what should have to do with this issue?
left side is scalar and right side is vector. and becuase of this error coming.
how can i convert vectro into scalar?

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by