2013-11-09 66 views
0

我在MATLAB輸入這個「雙師型」:MATLAB代碼鍵入

clc 
clear all 
close all 
u=1e-15:0.001:1; 
for u=0.00000000001:0.001:1; 
    w=int(exp(-u)/u,u,Inf); 
end 
figure; 
plot(u,w) 
grid on; 
title('plot of W(u), u less 1'); 
ylabel('W(u)'); 
xlabel('different values of u');` 

在這....我得到了錯誤

Undefined function or method 'int' for input arguments of type 'double' 

燦任何人都幫助我......?

回答

0

MatLab中沒有int方法。也許你想要的是int32

0

看看matlab help on integers

如果你只是想圓你可以使用ceilfloorroundfix,這會導致浮點變量恰好沒有小數部分的結果,但你會得到的舍入誤差爲真正的大數字。 help on floating point numbers中真正意義的是什麼。

如果您只想使用積分數據類型,請指定正確的一個,如int32uint8等,並帶有所有最大值和最小值的含義。