Creating a matrix for specific variables
이전 댓글 표시
t=0:0.0000001:0.0001;
DABi=zeros(1,length(t));
y=zeros(1,length(t));
vin=zeros(1,length(t));
vo=zeros(1,length(t));
L=27e-6;
f=50e3;
vo=square(2*pi*f*t);
for i=1:length(y)
j=mod(i-30,length(y))+1;
vin(i)=vo(j);
end
vin=800.*vin;
vo=400.*vo;
for i=2:length(t)
DABi(i)= ((vin(i)-vo(i))/L)*(t(i)-t(i-1))+DABi(i-1);
end
DABi=DABi-mean(DABi);
plot(t,DABi,"m");
hold on;
plot(t,vinp,"b");
hold on;
plot(t,vout,"r");
grid on;
legend('Current','Input Voltage', 'OUtput Voltage')
xlim([0 0.0001])
hold off;
I want to create 2 different matrices first based on the Input voltage and current and the second based on Output voltage and current. Let discuss only input voltage and current case.
For the first matrix I want to focus only on the point when input voltage switches (just the switching instance) to 400 and -400 value (All the rest point should be excluded from the matrix). When voltage switches to 400 value I want to look at current if it is negative I should get 1 if it is zero I should get 0 if it is positive value I should get +1. Whereas for -400 value if current is positive I should get 1 if it is zero I should get 0 if it is negative value I should get -1
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!