필터 지우기
필터 지우기

How can I correct this error?

조회 수: 1 (최근 30일)
Mallouli Marwa
Mallouli Marwa 2018년 6월 8일
댓글: Mallouli Marwa 2018년 6월 12일
Hello
I have done this program , no error is displayed but any curve is displayed.
Can you help me
clc; clear ; close all;
% acceleartion + displacement
cd Z:\Stage\Travail_fait\marwa
load data1; tmp = data1(:,1); disp = data1(:,2); acc = data1(:,3);
figure(1) plot(tmp, acc, 'b',tmp,acc,'r.') xlable('time (s)'); ylabel('Acceleration (ms^(-2))');
  댓글 수: 2
Stephan
Stephan 2018년 6월 8일
편집: Stephan 2018년 6월 8일
Hi,
your question is a little bit unclear. What is the problem?
clc;
clear ;
close all;
% acceleartion + displacement
cd Z:\Stage\Travail_fait\marwa
load data1;
tmp = data1(:,1);
disp = data1(:,2);
acc = data1(:,3);
figure(1)
plot(tmp, acc, 'b',tmp,acc,'r.')
xlabel('time (s)');
ylabel('Acceleration (ms^(-2))');
The actual code gives you a blue line with the acc over tmp values and additionally red dots from also acc over tmp. Do you want to show disp over tmp instead? Or does your curve not look like it should?
There was just one mistake in
xlable('time (s)');
which should be
xlabel('time (s)');
Please tell your problem a little more exactly. If possible attach data1 file.
Best regards
Stephan
Mallouli Marwa
Mallouli Marwa 2018년 6월 10일
Hi
See Data1 as attached.
I want also to show disp over tmp instead
Thanks for help

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

채택된 답변

Stephan
Stephan 2018년 6월 11일
Hi,
to show disp over tmp Change the plot command:
plot(tmp, acc, 'b',tmp,disp,'r.')
which will give you this result:
You could also work with subplots using the following code:
figure(1)
subplot(2,1,1)
plot(tmp, acc, 'b')
xlabel('time (s)');
ylabel('Acceleration (ms^(-2))');
subplot(2,1,2)
plot(tmp, disp, 'b')
xlabel('time (s)');
ylabel('Displacement');
Which gives you:
Best regards
Stephan
  댓글 수: 2
Mallouli Marwa
Mallouli Marwa 2018년 6월 12일
Thanks
Mallouli Marwa
Mallouli Marwa 2018년 6월 12일
I have added this part in the program that calculate the Fourier
Transform of the voltage but the trend is not well.
The curve FRF wanted attached is the best trend.
So How can I ameloirate the trend of this FRF found (figure3 in the program).
The program is:
%% %script traitement signal %objet : traitement signal MPF clc; clear; close all; cd Z:\Matlam\Curves_oscillo_Pc %%
%% load 'data1.txt';
tmp = data1(:,1);
disp = data1(:,2);
acc = data1(:,3);
figure(1)
plot(tmp,acc,'b',tmp,acc,'r.');
xlabel('time (sec)');
ylabel('Acc (ms^{-2})');
%on récupère les données de Oscilloscope en Volt
load 'data1V.txt';
tmpV = data1V(:,1);
Volt = data1V(:,2);
%Voltb = 40e-3*ones(size(tmpV));
figure(2)
plot(tmpV,Volt,'b',tmpV,Volt,'r.');
xlabel('time (sec)');
ylabel('Voltage(V)'); %%
L=length(tmp)
Lv=length(tmpV)
Fs = 5000; % Sampling frequency
NFFT = 2^nextpow2(L) % Next power of 2 from length of y
NFFTV = 2^nextpow2(Lv) % Next power of 2 from length of y
figure(3)
VOLT = fft(Volt,NFFT)/L; % Calcul de la FFT
amplitude = 2*abs(VOLT(1:NFFT));
f = Fs/2*linspace(0,1,NFFT/2);
semilogy(f(1:NFFT/12),2*abs(VOLT(1:NFFT/12)))
xlabel('frequency')
ylabel('FRF Volatage')

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by