필터 지우기
필터 지우기

y=0 line is added to my plot

조회 수: 8 (최근 30일)
Håkon Bye
Håkon Bye 2019년 5월 14일
댓글: KSSV 2019년 5월 14일
Hi
I'm currently trying to plot data exported from LTspice. However, when i use the "plot" function MATLAB adds the y=0 line as part of the plot. This does not happen when i use scatter and excatly the same settings. Here is a picture of the problem, and I've attached my code as well.
Thanks in advance!
Capture.PNG
data=csvread('deptesttest.csv',1,0);
dataus=data(:,1).*1e6;
% yyaxis left
plot(dataus(:,1),data(:,2).*1e-3,'--or','LineWidth',3);
set(gca,'FontSize',25);%axis font size
xlabel('time [\muS]','FontSize',25)
ylabel('Switching losses[W]','FontSize',25)
title('Current and power through switch during DP testing','FontSize',30)
axis ( [ 75.5 75.7 -10 140])
% yyaxis right
% plot(dataus(:,1),data(:,4),'LineWidth',3);
% legend('Losses MOSFET','Current MOSFET','FontSize',25)
% ylabel('Drain current MOSFET [A]','FontSize',25)
% axis ( [ 75 76 -10 140])
  댓글 수: 3
KSSV
KSSV 2019년 5월 14일
It seems your data has those values also.
Håkon Bye
Håkon Bye 2019년 5월 14일
Yes sorry, should have done that at the beginning. Here is the csv file im using. Thanks a lot

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

채택된 답변

KSSV
KSSV 2019년 5월 14일
data=csvread('deptesttest.csv',1,0);
data(data(:,2)==0,:)=[];
dataus=data(:,1).*1e6;
% yyaxis left
plot(dataus(:,1),data(:,2).*1e-3,'--or','LineWidth',3);
set(gca,'FontSize',25);%axis font size
xlabel('time [\muS]','FontSize',25)
ylabel('Switching losses[W]','FontSize',25)
title('Current and power through switch during DP testing','FontSize',30)
axis ( [ 75.5 75.7 -10 140])
  댓글 수: 2
Håkon Bye
Håkon Bye 2019년 5월 14일
thank you so much!! I've been struggeling with this for several hours now. What exactly does this "data(data(:,2)==0,:)=[];" line do in pseudocode?
KSSV
KSSV 2019년 5월 14일
That line removes the data which have y value (second column of data) zero.

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by