Challenge

Project - Data Handling and Interpolation

% Project # Basic Matlab:

clc

close all

clear all

vi=xlsread('VI.xlsx','A2:A25');% Read the current values from VI.xls file

vv=xlsread('VI.xlsx','B2:B25'); % Read the voltage values from VI.xls file

xq=(-17.3:0.1:0.9); %intervals

yq=interp1(vi,vv,xq);%interpolation for values of xq

plot(vv,vi,'o',yq,xq,'-') %plote the vv v/s vi with(o) & interpolation values

title('Data handling & Interpolation') % title added to graph

legend('value','interpolation') %added legend

xlabel('voltage (volts)') %added x-axis label as voltage

ylabel('current (mA)') %added y-axis label as current

VV=[-17.2;-17.1;13.8;-13.5;-13.0;-12.5;-11;-9;-5.76;-6;-1;0.11;0.25;0.5;0.61];

I=interp1(vi,vv,VV);% computing interpolation with given data VV

Z=[VV I] % move interpolating values to Z matrix

fid=fopen('VI.txt','w'); % created VI.text file

fprintf(fid,'%d\n',Z); % stored values of Z matrix to VI.text file

Ans-

%Data saved in VI.txt file.
-1.720000e+01
-1.710000e+01
1.380000e+01
-1.350000e+01
-13
-1.250000e+01
-11
-9
-5.760000e+00
-6
-1
1.100000e-01
2.500000e-01
5.000000e-01
6.100000e-01
-2.600000e+01
-24
NaN
-2.750000e+00
-2.500000e+00
-2.250000e+00
-1.650000e+00
-1.150000e+00
-7.013333e-01
-7.333333e-01
-1.888889e-01
0
0
1.700000e-01
1.610000e+00
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.