Interp1 error VqLite = F(Xqcol)
Mostrar comentarios más antiguos
clc;clear;
Filename= 'Homework 2 Dropsonde Updated2.xlsx';
T=readtable(Filename);
T.AirTemp= T.AirTemp + 273.15;
%Humidity Graph After Converson
R=T.RelHumid;
Temp= T.AirTemp;
p=T.AirPress;
A=[];
for i=1:length(R)
Aval=6.12*(R(i)/100)*(exp((17.67*(Temp(i)-273.15))/(Temp(i)-29.65)))*(p(i)/1013.25);
A(end+1) = Aval;
end
A= A';
%figure(3)
%plot(A,T.GeopotenAltitude)
%Question 1a
N=[];
for i=1:length(Temp)
Nval= (77.6/Temp(i))*(p(i)+ ((4810*A(i))/Temp(i)));
N(end+1)= Nval;
end
N= N';
% figure(1)
% plot(N,T.GeopotenAltitude)
% title('ECE 6735 HW2 Problem 1a');
% xlabel('Refractivity (mbar)');
% ylabel('Altitude (m)');
%Question 1c
alt= T.GeopotenAltitude;
n0=interp1(alt,N,0);
angle= deg2rad(0.2);
deltaX= 0.2;
h=0;
x=0;
Re= 6371 *10^3;
while h< 1000
alt
N
h
nh=interp1(alt,N,h);
h= h+ deltaX* sqrt((angle^2)+(2*(nh+(h/Re)-n0)));
x=x+deltaX;
end
So I am trying to create a code that takes in data from an exel and then uses the interp1 function to find the N value at that given height. I set h=0 sicne I am starting on the ground but when I use nh=interp1(alt, N, h) I get the error. When I use n0= interp1(alt, N, 0) I get an actual value.
I didnt think that using a variable instead of an actual value would matter if the variable had a number assigned to it.
Here is the error message:
Error in interp1 (line 152)
VqLite = F(Xqcol);
Error in ECE_6375_HW2_1 (line 45)
nh=interp1(alt,N,h);
5 comentarios
Jon
el 16 de Feb. de 2023
Please copy and paste your code using the code button on the MATLAB answers toolbar rather than using a screen shot which is hard to read, and can't be run by those trying to help solve your problem.
Also please copy and paste the full error message you receive as this can give immediate clues as to the cause of the problem.
Deanna
el 16 de Feb. de 2023
Jon
el 16 de Feb. de 2023
Also if you could make a self contained runnable example that reproduces the problem that would be very helpful. The code you have above can not be run as is, because we don't know the values for Temp, p, A etc
Deanna
el 16 de Feb. de 2023
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Time Series Objects en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!