我有来自电池放电曲线的实验室测试数据。数据包含22个电压与时间点。在matlab中,我通过样条插值跟踪了插值曲线,但是我希望得到这个曲线的导数,我该怎么做呢?
x = [0; 3600 ;7200 ;10800; 14400; 18000; 21600; 25200 ;28800;...
32400; 36000 ;39600 ;43200 ;46800; 50400 ;54000; 57600; 61200;...
64800 ;68400 ;72000; 74880];
y = [12.75; 12.40; 12.38; 12.34; 12.30; 12.26 ;12.21 ;12.17 ;...
12.12; 12.07; 12.02 ;11.97 ;11.91 ;11.85; 11.79; 11.72; 11.65;...
11.56 ;11.46 ;11.35 ;11.17; 10.59];
f = fit( x, y,'cubicinterp')
答案 0 :(得分:1)
您可以使用correctLetter = "J"
tries = 3
def letter_game(tries, correctLetter):
for i in range(tries):
guess = input ("Enter your guess ")
if letter_check(correctLetter, guess) == True:
print("Correct!")
break
if letter_check(correctLetter, guess) != True:
print("Game Over!")
def letter_check(l1, l2):
if l1 == l2.upper():
return True
elif l1 > l2.upper():
print ("You are wrong, but go closer to Z")
return False
elif l1 < l2.upper():
print ("You are wrong, but go closer to A")
return False
else:
return False
letter_game(tries, correctLetter)
的{{3}}:
y/x