help with fixing my plot please

조회 수: 1 (최근 30일)
random1072
random1072 2020년 3월 20일
댓글: Star Strider 2020년 3월 21일
Any insight on how to make my graph not jagged and more rounded or smooth so doesnt look so bad and also how to change the colors since i have 12 different forces i need 12 different colors so there arent two the same.. New to graphing so trying to figure this out and going crazy. Attatched is an image of my code and the matrix i am trying to graph (A_total) as well as an image of my current graph. Any insight would greatly be appreciated.

채택된 답변

Star Strider
Star Strider 2020년 3월 20일
My version of MATLAB cannot run images of code, only actual code, so I created an equivalent-size ‘A’ matrix:
A = rand(5, 12); % Create Data
figure
plot(A)
grid
title('Original')
xi = linspace(1, 5, 24); % Define ‘x’ With Increased Resolution
Ai = interp1((1:5).', A, xi, 'pchip'); % Interpolate
cm = jet(size(A,2)); % Define Colormap For Line Colors
figure
hold on
for k = 1:size(Ai,2)
plot(xi, Ai(:,k), 'Color',cm(k,:))
end
grid
title('Interpolated & Unique Colours')
This interpolates the matrix rows and then defines a colormap to plot lines with different colours. (Theare are alternate ways to do it without using the loop, however the loop is likely easiest.) Experiment with it to get the result you want.
  댓글 수: 6
random1072
random1072 2020년 3월 21일
this solution fixed the problem thank you.
Star Strider
Star Strider 2020년 3월 21일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by