필터 지우기
필터 지우기

Plotting a graph with multiple values

조회 수: 7 (최근 30일)
Samantha Ryan-Wheeler
Samantha Ryan-Wheeler 2021년 3월 22일
답변: Vineet Joshi 2021년 3월 24일
I am trying to plot a gragh using the Volts versus the 10 average currents shown in the picture. although the plot funtion is set up like plot( volts, ---) I have 10 different average currents that also need to be on the graph. any ideas on how I should do that?
  댓글 수: 3
Samantha Ryan-Wheeler
Samantha Ryan-Wheeler 2021년 3월 22일
yes i want a scatter plot
caroline bourn
caroline bourn 2021년 3월 23일

댓글을 달려면 로그인하십시오.

답변 (1개)

Vineet Joshi
Vineet Joshi 2021년 3월 24일
Hi
You can use the scatterfunction to plot a scatter plot between Volts Vs. Average current values.
Since scatter needs both the arguments to be vectors, you can convert average current values into a single vector before plotting.
You can refer the following code for example.
%Volt vector
Volts = [10,20,30,40,50];
%Average Current Values
AC_1 = -10; AC_2 = 20; AC_3 = 25; AC_4 = -5; AC_5 = 30.5;
%Average Current Vector
Average_Current = [AC_1, AC_2, AC_3, AC_4, AC_5];
%Scatter Plot
scatter(Volts, Average_Current,'filled')
xlabel('Volts')
ylabel('Average Current')
The output will look as follows.
Hope this helps.

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by