Question

write a matlab code that can plot 3 excel files? this plot know can run one...

write a matlab code that can plot 3 excel files? this plot know can run one excel file of 20crackf1.

clc;
clear all;
close all;
data1=xlsread('20f1','spectrum - PXI1Slot4_ai0','A8:B10009');% Importing excel file
x=data1(:,1);
y=data1(:,2);
plot(x,y);
xlim([0 100]);
xlabel('Frequency in Hz');
ylabel('Amplitude in g');
title('FFT');
hold on;
data2=xlsread('20crackf1','a1','A1:B5000');
x1=data2(:,1);
y1=data2(:,2);
plot(x1,y1);
xlim([0 100]);

0 0
Add a comment Improve this question Transcribed image text
Answer #1


clc;
clear all;
close all;
%define the names of all the excel files,here first,second and third are the %name of the excel workbooks
excel_wb={'first.xlsx','second.xlsx','third.xlsx'}
%define the names of all the excel sheets,here one, two and threee are the %names of the excel worksheet
excel_sheet={'one','two','three'}
%define the range of all the excel sheets,below defines the range of the excel %workbook
excel_range={"A8:B10009","A1:B5000","A1:B5000"}
% loop runs thrice as the length of the excel_wb is 3
for i = 1:length(excel_wb)
data=xlsread(excel_wb(i,i),excel_sheet(i,i),excel_range(i,i))
x=data(:,1);
y=data(:,2);
plot(x,y);
xlim([0 100]);
xlabel('Frequency in Hz');
ylabel('Amplitude in g');
title('FFT');
end

Add a comment
Know the answer?
Add Answer to:
write a matlab code that can plot 3 excel files? this plot know can run one...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • i got it incomplete sorry I put this by mistake. can this be canceled? 4. Use MATLAB or Scilab to implement linea...

    i got it incomplete sorry I put this by mistake. can this be canceled? 4. Use MATLAB or Scilab to implement linear regression, and plot the points and the curve for the following data sets. x [018 12 27) and y [12345 Input: (copy and paste the MATLAB or Sclab commandin the folowing bax) cic X1-101 8 12 271: Y1-11 234 5] Y-transpose(Y1) for n-1:5 X(n,2)-X1(n) end format long ycalc-S(2) X+S(1); scatter(X1,Y1) hold on plot(X,ycalc) xlabel(X) ylabel(Y) title('Linear Regression Relation...

  • Program from problem 1: (Using MATLAB) % Sampling frequency and sampling period fs = 10000; ts...

    Program from problem 1: (Using MATLAB) % Sampling frequency and sampling period fs = 10000; ts = 1/fs; % Number of samples, assume 1000 samples l = 1000; t = 0:1:l-1; t = t.*ts; % Convert the sample index into time for generation and plotting of signal % Frequency and amplitude of the sensor f1 = 110; a1 = 1.0; % Frequency and amplitude of the power grid noise f2 = 60; a2 = 0.7; % Generating the sinusoidal waves...

  • How can I get my while loop to run until my condition in my if statement...

    How can I get my while loop to run until my condition in my if statement is met? (In MATLAB) clc%clears screen clear all%clears history close all%closes all files format long %Euler's Method %Initial conditions and setup %Projectile motion x=3;%randi(3); y=3;%randi(3); figure('color','white'); plot(x,y,'bo'); hold on wind = (-10 + 20*rand(1)); fprintf('The wind speed is %2.2i\n',wind); v0= input('Initial velocity(m/s): '); a= input('Angle of projection(in degrees): '); a=a*pi/180; h=.01; cd=.1; %cdy=.1; %cdx=(rand*2-1)/2; %cdy=(rand*2-1)/2; m=1.5; g=9.8; %acceleration due to gravity in m/s^2 %td=2*v0*sin(a)/g;...

  • MATLAB code for a double pendulum. Please explain each lines for these codes pls. -------------------------------------...

    MATLAB code for a double pendulum. Please explain each lines for these codes pls. ---------------------------------------------------------------------------- clc close all clear all %---------Parameters------------------------------------------------------ L1=1; L2=1 ; M_1=2 ; M_2=1; G=9.8; %---------initial condition----------------------------------------------- tspan=30; theta1=3; theta1_prime=0; theta2=2.5; theta2_prime=0; y0=[theta1 theta1_prime theta2 theta2_prime]; [t,y]=ode45(@pend, [0 ,tspan],[ 3 0 2 0]); %---position of mass 1 and mass 2---------------------------------------- x1=L1*sin(y(:,1)); y1=-L1*cos(y(:,1)); x2=L1*sin(y(:,1))+l2*sin(y(:,3)); y2=-L1*cos(y(:,1))-l2*cos(y(:,3)); %------visualizing the result--------------------------------------------- figure(1) plot(x1,y1,'linewidth',2) hold on plot(x2,y2,'r','linewidth',2) h=gca; get(h,'fontSize') set(h,'fontSize',14) xlabel('X','fontSize',14); ylabel('Y','fontSize',14); title('Chaotic Double Pendulum','fontsize',14) fh = figure(1); set(fh, 'color', 'white'); figure(2)...

  • I wrote a Matlab program for the figure below. When I plot the waves, they look...

    I wrote a Matlab program for the figure below. When I plot the waves, they look the same. Why do the two waves frequencies look same and How do I avoid it? (I really do need this part of the question answered.) N = 200; % Total number of time domain samples in simulation. Fs = 100 ;% sampling frequency. F1 = 10; % frequency of wave - 1. F2 = 90; % frequency of wave - 2. phi =...

  • Hello, i have this matlab code where i have to track a red ball from and...

    Hello, i have this matlab code where i have to track a red ball from and uploaded video, and plot its direction in x-y direction My Question is how can i add x vs time plot and y vs time plot in this code. Thank you if exist('V','var') delete(V); end clear;clc; V=VideoReader('video.mp4'); figure(1); x=[];y=[]; i=1; while hasFrame(V) J=readFrame(V); figure(1);imshow(J);title(['Frame No. ',num2str(i)]); if (i>=28 && i<=132) bw=J(:,:,1)>200 & J(:,:,2)<80 & J(:,:,3)<80; bw=imfill(bw,'holes'); A=regionprops(bw,'Centroid'); x(end+1)=A.Centroid(1); y(end+1)=A.Centroid(2); hold on; plot(x,y,'*k');hold off; end i=i+1;...

  • Reproduce Figures 9.2b and 9.2c on MATLAB, assuming that the square wave (Figure 9.2b) is a...

    Reproduce Figures 9.2b and 9.2c on MATLAB, assuming that the square wave (Figure 9.2b) is a periodic symmetric square wave of normalized amplitude (A=1). Each student group should decide the power spectral density level of the channel noise. Compute the Fourier transform of the periodic square wave. clear all close all %%%% T=12*pi; %number of period x=linspace(0,T); t=x/pi y0=square(x); %square wave signal y0ft=fft(y0); %calculating Fourier Transformof signal y0fts=fftshift(y0ft); y0ftFinal=abs(y0ft); AWGN= rand(size(x)); %Calculating whit noise Att=(1/3); nSig= Att*AWGN; y=y0+nSig; %Square wave...

  • Need help with this simple MATLAB code. I'm trying to plot a new set of Y...

    Need help with this simple MATLAB code. I'm trying to plot a new set of Y values from input X values. I get an error that says: "not enough input arguments." clear all clc close all Q = 3.44E+18; D = 1.51E-17; t = 7200; x = [1E-6 2E-6 2.5E-6 3E-6 4.32E-6]; y = Q/sqrt((pi*D*t))*exp^(-(x)^2/(4*D*t)) plot(x,y, '*r') xlabel('Depth'), ylabel('Concentration')

  • please help me with this MATLAB CODE and explain to me what each line does and...

    please help me with this MATLAB CODE and explain to me what each line does and what is used for? leave your comments as words, not as pictures. ..................................................................................................................................................................... clear all; close all; % For a script file, you better start with clear all and close all                        % However, for a fucntion, you better NOT to start                        % with them %% End of cell mode example %% Plot function t = 0:0.1:5; x1 = sin(2*5*t); x2 = cos(3*7*t);...

  • Can you please help me answer Task 2.b? Please show all work. fs=44100; no_pts=8192; t=([0:no_pts-1]')/fs; y1=sin(2...

    Can you please help me answer Task 2.b? Please show all work. fs=44100; no_pts=8192; t=([0:no_pts-1]')/fs; y1=sin(2*pi*1000*t); figure; plot(t,y1); xlabel('t (second)') ylabel('y(t)') axis([0,.004,-1.2,1.2]) % constrain axis so you can actually see the wave sound(y1,fs); % play sound using windows driver. %% % Check the frequency domain signal. fr is the frequency vector and f1 is the magnitude of F{y1}. fr=([0:no_pts-1]')/no_pts*fs; %in Hz fr=fr(1:no_pts/2); % single-sided spectrum f1=abs(fft(y1)); % compute fft f1=f1(1:no_pts/2)/fs; %% % F is the continuous time Fourier. (See derivation...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT