I am not able to plot the last loop in my figure with R(xx) figure(1) for xx=1:5; plot(R(xx),'--'); end .What is the issue with plotting the data from the curve fit? How do I solve it?
1 view (last 30 days)
Show older comments
BHARAT SINGH RAWAT
on 20 Jan 2020
Commented: BHARAT SINGH RAWAT
on 20 Jan 2020
clc;
clear all;
close all;
%-------Date:20122019--------Doppler Shift Spectroscopy Experiment Data---%
%Grating :1200lines/mm Acquistion time:10s slit width:50M=mircon%
%Pressure 2E-4 Torr%
Ar=3.14; %Area in cm2 of one FC
calF = 1000/(Ar*100); % calbration for mA/cm2
%--------------------------------HV:600V----------------------------------%
a1 =csvread('WAVE0001.CSV',11,0);%Line 696nm %
a2 =csvread('WAVE0002.CSV',11,0);%Line 750nm %
a3 =csvread('WAVE0003.CSV',11,0);%Line 763nm %
a4 =csvread('WAVE0004.CSV',11,0);%Line 772nm %
a5 =csvread('WAVE0005.CSV',11,0);%Line 811nm %
Y =zeros(5,11);
Y(1,:)=mean(a1(71:81,2:12))*1000*calF;
Y(2,:)=mean(a2(71:81,2:12))*1000*calF;
Y(3,:)=mean(a3(71:81,2:12))*1000*calF;
Y(4,:)=mean(a4(71:81,2:12))*1000*calF;
Y(5,:)=mean(a5(71:81,2:12))*1000*calF;
[K, B, Z, D] = deal(zeros(5,1)); %---pre allocation of arrays-----%
A=[-120,-96,-72,-48,-24,0,24,48,72,96,120];%---Axial Distance---------%
%--------------------Plotting Raw data------------------------------------%
figure(1)
for ii=1:5
plot(A,Y(ii,:),'o','LineWidth',2,'MarkerSize',10);
hold on
grid on
end
coefficient_fit = zeros(5,3) ;
%------------------Fitting the data with Gaussian-------------------------%
for i = 1:5
R = fit(A',Y(i,:)','gauss1');
coefficient_fit(i,:) = coeffvalues(R);
end
%----------------Extracting coefficients of fit--------------------------%
for j = 1:5
K(j)=coefficient_fit(j,3) ;
K3(j) = K(3);
K1(j) = K(1) ;
end
%--------------Beam diameter estimation--------------------------------%
for q = 1:5;
B(q) = sqrt(2)*K(q) ;
%--------------Divergence estimation-----------------------------------%
for t = 1:5;
D(t)=(180/3.14)*atan((B(t)-55)/(628));
end
end
figure(1)
for xx=1:5;
plot(R(xx),'--');
end
0 Comments
Accepted Answer
KALYAN ACHARJYA
on 20 Jan 2020
Edited: KALYAN ACHARJYA
on 20 Jan 2020
figure,
for xx=1:5;
plot(R(xx),'--'); % Is it plot with one variable only?
hold on;
end
More Answers (0)
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!