フィルターのクリア

how to comment on ploting data in graph?

6 ビュー (過去 30 日間)
Engineer Batoor khan mummand
Engineer Batoor khan mummand 2020 年 10 月 22 日
編集済み: Image Analyst 2020 年 10 月 22 日
Hi all;
i want to plot these two series of data and just nominate or comment two valuse from below series of data in ploting graph.
for example i want to give comment or name to 789 as required value in graph or 500 name as critical value.
solar radiation=[456 789 999 334 556 778 456 234 545 343 300 400 500 600 345]
heat gain=[456 789 765 345 234 654 768 979 567 456 678 453 867 989 234 ]
i will be very thankful .
thanks
  2 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 10 月 22 日
The two vectors you have written have different lengths.
Engineer Batoor khan mummand
Engineer Batoor khan mummand 2020 年 10 月 22 日
i editted my question dear .

サインインしてコメントする。

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 10 月 22 日
You can do something like this
solar_radiation=[456 789 999 334 556 778 456 234 545 343 300 400 500 600 345];
heat_gain=[456 789 765 345 234 654 768 979 567 456 678 453 867 989 234];
ax = axes();
hold on
p1 = plot(solar_radiation, heat_gain);
p2 = plot(500, heat_gain(solar_radiation==500), '.', 'MarkerSize', 50, 'DisplayName', 'Required Value');
p3 = plot(789, heat_gain(solar_radiation==789), '.', 'MarkerSize', 50, 'DisplayName', 'Critical Value');
legend([p2 p3])
  2 件のコメント
Engineer Batoor khan mummand
Engineer Batoor khan mummand 2020 年 10 月 22 日
thank you so much dear...
i want to import average of each day solar radiation from attached excel file but average of those solar radiation values which is greather than 200 for each day .
i will be very thankful dear.
thanks
Image Analyst
Image Analyst 2020 年 10 月 22 日
編集済み: Image Analyst 2020 年 10 月 22 日
Here it is again.
[numbers, strings, rawData] = xlsread('hiii.xlsx');
daysOfWeek = strings(2:end, 2);
% Threshold at 200
goodIndexes = numbers >= 200;
% Extract only those elements above 200.
numbers = numbers(goodIndexes);
daysOfWeek = daysOfWeek(goodIndexes);
% Label each individual day.
sequentialDays = ones(length(daysOfWeek), 1);
for k = 2 : length(sequentialDays)
if ~strcmpi(daysOfWeek{k}, daysOfWeek{k-1})
% It's not the same as the prior day so we're starting a new day.
sequentialDays(k:end) = sequentialDays(k-1) + 1;
end
end
% Get the averages over any and all hours of each day.
dailyAverages = splitapply(@mean, numbers, sequentialDays);
plot(dailyAverages, 'b-', 'LineWidth', 2);
title('Daily Average of Solar Radiation', 'FontSize', 18);
xlabel('Day', 'FontSize', 18);
ylabel('Average over the Day', 'FontSize', 18);
grid on;
% Smooth the daily averages
smoothedAverages = movmean(dailyAverages, 45);
hold on;
plot(smoothedAverages, 'r-', 'LineWidth', 4);
legend('Data >= 200', 'Smoothed');
g = gcf;
g.WindowState = 'maximized';
fprintf('Done running %s.m ...\n', mfilename);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeodesy and Mapping についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by