Using Inequality in a For loop
显示 更早的评论
I am attempting to perform a sensitivity analysis on an inequality of two variables, of the form: 4x < y < 40x. I want to use a for loop to make an array of y values for each incremental change in x, and create a plot to visualize the values of y for each x. My biggest issue has been representing the inequality within the for loop, here is the code that I have so far:
%% Sensitivity Analysis
D_rs = 8; %Ratio of D_85(s) and D_15(s), for any value of each
i=0;
for D15_s = 0:0.1:2
4*D15_s < D15_f < (5*D_rs)*D15_s; % <<<issue with representing this inequality>>>
i=i+1;
D15_sg(i)=D15_s; % storing the varied input D15_s in an array
D15_fg(i)=D15_f; % storing the output variable D15_f in an array
end
plot(D15_sg,D15_fg)
xlabel('-')
ylabel('-')
title('-')
采纳的回答
更多回答(1 个)
Walter Roberson
2020-4-11
4*D15_s < D15_f & D15_f < (5*D_rs)*D15_s
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
