0
以下是我的代碼。我想在繪製的東西3 d:matlab error matrix diminsion error
vp = 6000;
vs = 1.0e+03 .*[0.5000, 0.6094 , 0.7188 , 0.8281 , 0.9375 , 1.0469 , 1.1562 , 1.2656 , 1.3750 , 1.4844, 1.5938 , 1.7031 , 1.8125 , 1.9219 ,2.0312 , 2.1406,2.2500 , 2.3594 , 2.4688 , 2.5781 ,2.6875 ,2.7969 , 2.9062 , 3.0156 , 3.1250 , 3.2344 , 3.3438 , 3.4531 , 3.5625 , 3.6719 ,3.7812 ,3.8906];
% y= vp ./ vs;
y1= [12.0000,9.8462, 8.3478, 7.2453, 6.4000, 5.7313, 5.1892, 4.7407, 4.3636, 4.0421, 3.7647, 3.5229, 3.3103, 3.1220, 2.9538, 2.8029,2.6667 ,2.5430 ,2.4304 ,2.3273 ,2.2326 ,2.1453 , 2.0645 ,1.9896 ,1.9200 ,1.8551 ,1.7944 ,1.7376 ,1.6842 ,1.6340 ,1.5868 ,1.5422];
x = (0:0.2:2*pi); %# set a range for vale of x
[X, Y] = meshgrid(x, y);
p = sin(x);
theta= [0.0833, 0.1016, 0.1198, 0.1380 , 0.1562 , 0.1745 , 0.1927 , 0.2109 , 0.2292 , 0.2474 , 0.2656, 0.2839 , 0.3021 , 0.3203, 0.3385 , 0.3568, 0.3750, 0.3932, 0.4115, 0.4297 , 0.4479 , 0.4661 , 0.4844 , 0.5026 , 0.5208 , 0.5391 , 0.5573 , 0.5755 ,0.5938 , 0.6120 ,0.6302 , 0.6484];
curl = ((theta .^ 2) - ((vs .* p) .^ 2)) .^ 0.5
R_o = (1-2*(vs.^2)) ;
k_o = (1 -2*(vs.^2)./(R_o));
R_pv = (2*curl.^(-1)).*(k_o).*((sin(x)).^2);
mesh(x,R_pv,y1)
的問題是在這裏:
curl = ((theta .^ 2) - ((vs .* p) .^ 2)) .^ 0.5;
我得到以下錯誤:
??? Error using ==> times
Matrix dimensions must agree.
Error in ==> project1_Rpv at 11
curl= ((theta .^ 2) - ((vs .* p) .^ 2)) .^ 0.5;
嘗試在問題:
我有一個直覺,我搞亂了一些矩陣,但不知道在哪裏。我確定我的矩陣是1x1並且長度相同。
編輯:感謝奧利查爾斯沃斯,我已經修復了vs
的長度。現在我收到以下錯誤:
??? Error using ==> mesh at 80
Z must be a matrix, not a scalar or vector.
Error in ==> project1_Rpv at 18
mesh(x, R_pv, y1) ## (x, y, z)
我所有的矩陣都是1x1但我仍然收到錯誤。
輸入'size(vs)'和'size(p)',然後比較! –
哦,我見,我以爲我解決這個問題, 感謝 – Quark
仍然得到錯誤,我已經編輯我的帖子看看下面編輯...當我過去在這裏變得凌亂 ???錯誤我們...... – Quark