Filling 2D array with a function, all at once.
古いコメントを表示
Hello,
I would like to fill arrays of given dimensions by a function.
% Alfas e betas [ms^-1]
alfan(1:nn,1:np) = an(vm);
betan(1:nn,1:np) = bn(vm);
alfam(1:nn,1:np) = am(vm);
betam(1:nn,1:np) = bm(vm);
alfah(1:nn,1:np) = ah(vm);
betah(1:nn,1:np) = bh(vm);
one of functions:
function [ alfan ] = an( vm )
if vm == 10.0
alfan = 0.1;
else
alfan = (0.01*(10.0-vm))/(exp((10.0-vm)/10.0)-1.0);
end
end
It was working well for only temporal evolution:
alfan(1,1:np) = an(vm);
but now it does not:
>> Trabalho2
Warning: Rank deficient, rank = 1, tol = 3.815924e-10.
> In an (line 5)
In Trabalho2 (line 81)
Subscripted assignment dimension mismatch.
Error in Trabalho2 (line 81)
alfan(1:nn,1:np) = an(vm);
Is there any simple way to solve this problem without filling array element by element? I need at least first column filled. It can be only first row if I make alfan(1:np,1:nn).
All files attached.
Thank you in advance.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


