MATLAB Answers

graph with two formulas

4 ビュー (過去 30 日間)
grace khashman
grace khashman 2021 年 9 月 13 日
コメント済み: grace khashman 2021 年 9 月 13 日
Hello everyone
im trying to do like this graph below with the information in the excel file below in matlab.
my graph has to contain two serieses (unsucessful attacs- in red and sucessful attacs -in green)
also the y axis has to desplay (the % of sucessful and unsucessful attacks wich are in cloumn A in my excel file) and the X axis has to desplay (the con den of sucessful and unsucessfull attacks which are in cloumn B in my excel file)
how can i do this in matlab?
please help me
i appreciated it
  2 件のコメント
grace khashman
grace khashman 2021 年 9 月 13 日
hello
i tried the plot function but the graph didn't seem that it is similar to this so i am trying to search for another function.
x = [0:5:100]
y = [0:0.5:1]
plot (x,y)

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

採用された回答

Rik
Rik 2021 年 9 月 13 日
You probably want the errorbar function:
x = 1:10:100;
y = [20 30 45 40 60 65 80 75 95 90];
err = 8*ones(size(y));
errorbar(x,y,err)
  1 件のコメント
grace khashman
grace khashman 2021 年 9 月 13 日
rik thank you soooooo much i aprechiate it

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

その他の回答 (1 件)

Dave B
Dave B 2021 年 9 月 13 日
You can make the error bars with the errorbar function, but your excel file doesn't appear to include data about error...
a=readtable('LAST .xlsx','Range','A1:B9');
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
b=readtable('LAST .xlsx','Range','A10:B18');
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
a=sortrows(a,'unsucessfulConDen');
b=sortrows(b,'successfulConDen');
clf
plot(a.unsucessfulConDen,a.x_UnsucessfulAttacks,'LineWidth',1)
hold on
plot(b.successfulConDen,b.x_SucessfulAttacks,'LineWidth',1)
legend('Unsuccessful','Successful')
  1 件のコメント
grace khashman
grace khashman 2021 年 9 月 13 日
guys you are the best, thank you so much dave i apprciate it.

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by