How do I stop data being rounded when plotting a graph with 2 y-axis?

조회 수: 9 (최근 30일)
Paul Stacey
Paul Stacey 2018년 11월 15일
댓글: Paul Stacey 2018년 11월 15일
I have 2 sets of data, both of which are sine waves. The sine waves are slightly out of phase, and I'm trying to plot them so they're in phase so I can compare them. To do this I'm effectively ignoring the first 100us of data for the output wave, and also ignoring the last 100us of the input wave. When I do this, it looks like this:
Both.png
As you can see the orange value is being rounded to some discrete values, rather than being a perfect sine wave.
If I plot the output data on its own, this is what I get:
Single.png
Anyone have any ideas how I can stop this happening? This is the code I'm using to import and plot the 2 y-axis graph:
Amp = csvread('Amp_Out.csv',1,1);
CIN = csvread('Capacitor_Value.csv',1,1);
yyaxis left
plot(Time(1:36428),CIN(1:36428))
ylabel('Capacitance Value')
yyaxis right
plot(Time(1:36428),Amp(1969:38396))
ylabel('Amp Out')
xlabel('Time')
title('Capacitance and Output')

답변 (1개)

madhan ravi
madhan ravi 2018년 11월 15일
Fit the curve using interp1() with the method 'spline' then you should get a perfect curve
  댓글 수: 1
Paul Stacey
Paul Stacey 2018년 11월 15일
Does this just fix the graph, or does it fix the data? My end goal is to test linearity between the two sets of data - but when I plot them against each other its again being set to discrete values

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by