フィルターのクリア

make the line with the graph

1 回表示 (過去 30 日間)
whiyan
whiyan 2020 年 12 月 15 日
回答済み: Alan Stevens 2020 年 12 月 15 日
vin=linspace(0.2,2.8);
if vin < 0.5
current=0;
elseif 1.5 > vin >= 0.5
current=(860*10^-6)*(vin-0.5).^2;
elseif 2.5 > vin >= 1.5
current=(860*10^-6)*(2*(vin-0.5)*0.049-(0.049)^2) ;
elseif vin >= 2.5
current=(860*10^-6)*(2*(vin-0.5)*0-(0)^2) ;
end
end
plot(vin,current)
---------------------------------
Above is the code and hoped that make it into divided 4 part. (current versus vin)
but it has errors and could not catch how can mend it.

採用された回答

Alan Stevens
Alan Stevens 2020 年 12 月 15 日
More like this
vin=linspace(0.2,2.8);
current = zeros(1,numel(vin));
for i = 1:numel(vin)
v = vin(i);
if v < 0.5
current(i)=0;
elseif 1.5 > v && v >= 0.5
current(i)=(860*10^-6)*(v-0.5).^2;
elseif 2.5 > v && v>= 1.5
current(i)=(860*10^-6)*(2*(v-0.5)*0.049-(0.049)^2) ;
elseif v >= 2.5
current(i)=(860*10^-6)*(2*(v-0.5)*0-(0)^2) ;
end
end
plot(vin,current)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by