help me with this for loop please
古いコメントを表示
x = -10:0.1:10;
y = 0:0.005:1;
minNmax1 = 0:.005:1;
upper_1 = 0:.005:1;
y2 = 0:.005:1;
f1 = trapmf(x,[-2 0 0 2].');
minNmax1 = zeros(length(x), 2);
for k = 1 :length(y)
minNmax1(k,:) = [min(x),max(x)];
end
I'm trying to get [min(x),max(x)] for 201 values of y but this will only give me 1 answer [-10 10] which i assume is the first iteration?
help!
6 件のコメント
Katalin
2015 年 6 月 23 日
Sorry it is not clear what you would like in your variable. min(x) and max(x) are both constants, it will fill your 201x2 matrix with -10 in the first column and 10 in the second. Could you please explain more what you would like to achieve?
I cannot understand your notation. What does "@ y = 0.01 min(x), max(x)" mean? There is no "y" in this expression on the right hand side. What does the "y=0.01" part mean? Which y-values do you want to check and do you think that any y-value is exactly 0.01?
Perhaps you want "f1" to appear anywhere?
Katalin
2015 年 6 月 23 日
How does f1 depend on y?
soloby
2015 年 6 月 23 日
回答 (1 件)
Muhannad
2015 年 6 月 24 日
0 投票
will min(x) always be the same number as x is not changing? you can use repmat(min(x), 201,1)) if that is the case
カテゴリ
ヘルプ センター および File Exchange で Graphics Object Properties についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
