why is plot from workspace(using load command ) is slow ?

5 views (last 30 days)
Hi I want to plot data from workspace (using the load command ) ,but for some reason the plot is very slow and then matlab gets stuck , why is that ?
I uploaded the workspace file,and the code I display here :
ADC_data_lim43=load('Data_Lim_43');
dec_limit=43;
f_RD_not=892.858e3;
real_data_ADC=ADC_data_lim43.real_data_ADC;
I_real=real_data_ADC*(19.6e-3)/(100*15e-3); %%real current
real_data_IN_driver=ADC_data_lim43.real_data_IN_driver; %% real gate signal
t=(1/f_RD_not)*(1:length(real_data_IN_driver)); %% time
figure(101);
plot(t,I_real,' red -- d ','linewidth',1); %% plot--> of I_real
hold on ;
plot(t,dec_limit*(19.6e-3)/(100*15e-3)*ones(size(t)),' black ','linewidth',3); %% plot--> of boundery limit
hold on ;
plot(t,100*(19.6e-3)/(100*15e-3)*real_data_IN_driver*ones(size(t)),' blue -- O ','linewidth',1); %% plot--> comperator output
title([' I_1(t) from ADC , Boundery Limit Current=' num2str(dec_limit*(19.6e-3)/(100*15e-3)) '[A]']);
ylabel('I[A]');xlabel('time[ mSec]');grid on;
legend ('I_{real}','boundery limit','comperator output');
xlim([ 0 t(end)]); %% limits of the x axis
xticks([0:0.0002:t(end)]); %% jumps of X axis
ylim([ 0 max(I_real)]); %% limits of the y axis
yticks([ 0:0.1:max(I_real)]); %% jumps of Y axis
I also tried using opengl command and changed Software option to 'true' (it was 'false') but now it works even worse ...

Accepted Answer

Walter Roberson
Walter Roberson on 24 Dec 2019
100*(19.6e-3)/(100*15e-3)*real_data_IN_driver*ones(size(t))
That code involves a 2040 x 1 matrix, and the * operator, and ones(size(t)) is 1 x 2040 . So you have (2040 x 1) * (1 x 2040) and the result of that is a 2040 x 2040 matrix. You are therefore asking MATLAB to plot 2040 lines of 2040 elements each.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!