Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Keep getting "Unable to perform assignment because the indices on the left side are not compatible with the size of the right side."

조회 수: 1 (최근 30일)
clear all;
close all;
clc;
global t Ts Tm T Qmax CVS CVD tauD tauS
% Initial Conditions
Rs = 17.5; % mmHg/(liter/min)
Rp = 1.79;
Csa = 0.01;% liters/mmHg
Csv = 1.75;
Cpa = 0.00667;
Cpv = 0.08;
Kr = 2.8; % (liters/min)/mmHg
Kl = 1.12;
V0 = 5.0; % Liters
%Time Span
Ts=0.0050; % (minutes) length of systolic phase
Tm=0.0020; % (minutes) length of diastolic phase
Qmax=28; % (liters/minute) maximum flow
T=0.0125; % (minutes) How many minutes it takes for a single heartbeat
t=linspace(0,T,1000);
%Compliance Variables
CVD = 0.0146; %Liters/mmHg Starting Clvd value
CVS = 0.00003; %Liters/mmHg Starting Clvs value
tauS = 0.0025; %Minutes
tauD = 0.0075; %Minutes
% Flow
for i=1:length(t)
if 0<=t(i) && t(i)<=Tm
Q(i)=Qmax*t(i)/Tm;
elseif Tm<=t(i) && t(i)<=Ts
Q(i)=Qmax*(Ts-t(i))/(Ts-Tm);
else
Q(i)=0;
end
end
plot(t,Q);
hold on
%Q For Sytemic Arteries
for i = 1:length(t)
if 0<=t(i) && t(i)<=Tm
Qsa(i) = (Qmax.*t)/Tm; %%Error appears here
elseif Tm<=t(i) && t(i)<=Ts
Qsa(i) = (Qmax.*(Ts-t))/(Ts-Tm);
elseif Ts<=t(i) && t(i)<= T
Qsa(i) = 0;
end
end
plot(t,Qsa)

답변 (1개)

Dhanashree Mohite
Dhanashree Mohite 2019년 4월 8일
As per my understanding Line no. 41 and 43 should contain t(i) instead of t.
Line no. 43 should be
Qsa(i) = (Qmax.*(Ts-t(i)))/(Ts-Tm);
Line no. 41 should be
Qsa(i) = (Qmax.*t(i))/Tm; %%Error appears here

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by