已知圆周上各点坐标,如何将圆转换为360度直线
本帖最后由 guohf 于 2013-5-24 11:21 编辑我有一240*4的矩阵,前两列正好是分布在一个半径为0.005圆周上的坐标点(如图1中的红*),我的目的是将前两列经反三角或其他方式转换为对应的360度直线,然后以这条直线为x轴,分别得到矩阵的第三、四列的二维图,想得到如图2的结果,但我经反三角函数变化后(试过很多方法),得到的图很乱。请高手帮下忙,先谢谢了
图1,前两列对应的图 图2 x轴是由前两列转换而得的
下面是我的部分数据(整个数据在附件里)
2.1195130e-018 -5.0000004e-003 -5.8866244e+0038.3838407e+003
-1.2927217e-004 -4.9983291e-003 -6.4644268e+0038.4098488e+003
1.2927217e-004 -4.9983291e-003 -5.3442376e+0038.2814140e+003
-2.5952412e-004 -4.9932608e-003 -7.0453113e+0038.4341468e+003
2.5952412e-004 -4.9932608e-003 -4.9248484e+0038.0371400e+003
-3.9040763e-004 -4.9847346e-003 -7.6547117e+0038.4517707e+003
3.9040763e-004 -4.9847346e-003 -4.5412538e+0037.8258028e+003
-5.2156451e-004 -4.9727228e-003 -8.2930520e+0038.4763877e+003
5.2156451e-004 -4.9727228e-003 -4.1754575e+0037.7050938e+003
-6.5263093e-004 -4.9572247e-003 -8.8750256e+0038.4573361e+003
6.5263093e-004 -4.9572247e-003 -3.9336525e+0037.7314030e+003
-7.8324275e-004 -4.9382723e-003 -9.3956711e+0038.4560658e+003
7.8324275e-004 -4.9382723e-003 -3.7928207e+0037.9660194e+003
-9.1303955e-004 -4.9159294e-003 -9.9061493e+0038.4296295e+003
9.1303955e-004 -4.9159294e-003 -3.5791294e+0038.0809199e+003
-1.0416699e-003 -4.8902892e-003 -1.0382426e+0048.3558926e+003
1.0416699e-003 -4.8902892e-003 -3.2145386e+0037.9438170e+003
-1.1687954e-003 -4.8614722e-003 -1.0782399e+0048.2597157e+003
1.1687954e-003 -4.8614722e-003 -2.9140631e+0037.8138520e+003
-1.2940953e-003 -4.8296293e-003 -1.1087138e+0048.1446527e+003
1.2940953e-003 -4.8296293e-003 -2.7736140e+0037.6369052e+003
我的程序:
clear;clc;
load z02ms.dat %数据名
x=z02ms(:,1);y=z02ms(:,2);r=abs(sqrt(x.^2+y.^2));
=size(z02ms);
ang=;%ang是前两列转化对应角,也曾直接用“ = cart2pol(z02ms(:,1),z02ms(:,2));”等转过
for i=1:m
if x(i,1)>0 && y(i,1)>0
ang(i,1)=asind(y(i,1)/r(i,1));
elseifx(i,1)<0 && y(i,1)>0
ang(i,1)=90-acosd(y(i,1)/r(i,1));
elseifx(i,1)<0 && y(i,1)<0
ang(i,1)=180-asind(y(i,1)/r(i,1));
else
ang(i,1)=270-acosd(y(i,1)/r(i,1));
end
end
me=z02ms(:,3);st=z02ms(:,4);
subplot 211, plot(ang,me);
xlabel('\it\theta\^o');ylabel('mean pressure');
title('mean pressure ');
grid on
subplot 212, plot(ang,st);
xlabel('\it\theta\^o');ylabel('Fluctuating pressure');
title('Fluctuating pressure rms');
grid on
刚意识到下载附件还要扣分,所以把全部数据给出,请高手帮忙。
2.1195130e-018 -5.0000004e-003 -5.8866244e+0038.3838407e+003
-1.2927217e-004 -4.9983291e-003 -6.4644268e+0038.4098488e+003
1.2927217e-004 -4.9983291e-003 -5.3442376e+0038.2814140e+003
-2.5952412e-004 -4.9932608e-003 -7.0453113e+0038.4341468e+003
2.5952412e-004 -4.9932608e-003 -4.9248484e+0038.0371400e+003
-3.9040763e-004 -4.9847346e-003 -7.6547117e+0038.4517707e+003
3.9040763e-004 -4.9847346e-003 -4.5412538e+0037.8258028e+003
-5.2156451e-004 -4.9727228e-003 -8.2930520e+0038.4763877e+003
5.2156451e-004 -4.9727228e-003 -4.1754575e+0037.7050938e+003
-6.5263093e-004 -4.9572247e-003 -8.8750256e+0038.4573361e+003
6.5263093e-004 -4.9572247e-003 -3.9336525e+0037.7314030e+003
-7.8324275e-004 -4.9382723e-003 -9.3956711e+0038.4560658e+003
7.8324275e-004 -4.9382723e-003 -3.7928207e+0037.9660194e+003
-9.1303955e-004 -4.9159294e-003 -9.9061493e+0038.4296295e+003
9.1303955e-004 -4.9159294e-003 -3.5791294e+0038.0809199e+003
-1.0416699e-003 -4.8902892e-003 -1.0382426e+0048.3558926e+003
1.0416699e-003 -4.8902892e-003 -3.2145386e+0037.9438170e+003
-1.1687954e-003 -4.8614722e-003 -1.0782399e+0048.2597157e+003
1.1687954e-003 -4.8614722e-003 -2.9140631e+0037.8138520e+003
-1.2940953e-003 -4.8296293e-003 -1.1087138e+0048.1446527e+003
1.2940953e-003 -4.8296293e-003 -2.7736140e+0037.6369052e+003
-1.4185300e-003 -4.7945566e-003 -1.1274147e+0048.0369644e+003
1.4185300e-003 -4.7945566e-003 -2.8019097e+0037.4972708e+003
-1.5430320e-003 -4.7559487e-003 -1.1354019e+0047.9285844e+003
1.5430320e-003 -4.7559487e-003 -2.9095901e+0037.4298618e+003
-1.6672491e-003 -4.7138394e-003 -1.1327432e+0047.7975477e+003
1.6672491e-003 -4.7138394e-003 -3.0406127e+0037.5369407e+003
-1.7908278e-003 -4.6682907e-003 -1.1182979e+0047.6836179e+003
1.7908278e-003 -4.6682907e-003 -3.1803845e+0037.6832888e+003
-1.9134174e-003 -4.6193972e-003 -1.0912849e+0047.5771962e+003
1.9134174e-003 -4.6193972e-003 -3.3237851e+0037.7713765e+003
-2.0346732e-003 -4.5672869e-003 -1.0529035e+0047.4749238e+003
2.0346732e-003 -4.5672869e-003 -3.4627944e+0037.7851601e+003
-2.1542646e-003 -4.5121107e-003 -1.0029818e+0047.3728284e+003
2.1542646e-003 -4.5121107e-003 -3.6036522e+0037.8323705e+003
-2.2718757e-003 -4.4540521e-003 -9.4258745e+0037.2844855e+003
2.2718757e-003 -4.4540521e-003 -3.7402531e+0037.9224768e+003
-2.3872112e-003 -4.3933159e-003 -8.7251019e+0037.1988563e+003
2.3872112e-003 -4.3933159e-003 -3.8158945e+0037.9760933e+003
-2.5000002e-003 -4.3301275e-003 -7.9385397e+0037.1266135e+003
2.5000002e-003 -4.3301275e-003 -3.8531421e+0037.9554405e+003
-2.6111174e-003 -4.2640436e-003 -7.0590777e+0037.0554833e+003
2.6111174e-003 -4.2640436e-003 -3.8599078e+0037.8481994e+003
-2.7213846e-003 -4.1945283e-003 -6.0966775e+0036.9976077e+003
2.7213846e-003 -4.1945283e-003 -3.8670512e+0037.6872341e+003
-2.8304704e-003 -4.1217031e-003 -5.0529146e+0036.9422945e+003
2.8304704e-003 -4.1217031e-003 -3.9424484e+0037.5583865e+003
-2.9380494e-003 -4.0457221e-003 -3.9370487e+0036.8954490e+003
2.9380494e-003 -4.0457221e-003 -4.0271112e+0037.5486465e+003
-3.0438069e-003 -3.9667669e-003 -2.7558151e+0036.8519553e+003
3.0438069e-003 -3.9667669e-003 -4.1660842e+0037.6539277e+003
-3.1474445e-003 -3.8850475e-003 -1.5137730e+0036.8108017e+003
3.1474445e-003 -3.8850475e-003 -4.3200437e+0037.7174566e+003
-3.2486799e-003 -3.8007996e-003 -2.2291883e+0026.7766385e+003
3.2486799e-003 -3.8007996e-003 -4.4060652e+0037.6478927e+003
-3.3472569e-003 -3.7142793e-0031.1093283e+0036.7446133e+003
3.3472569e-003 -3.7142793e-003 -4.3785721e+0037.4891872e+003
-3.4429429e-003 -3.6257613e-0032.4910483e+0036.7129861e+003
3.4429431e-003 -3.6257615e-003 -4.2579499e+0037.3751385e+003
-3.5355338e-003 -3.5355338e-0033.8499597e+0036.6818341e+003
3.5355338e-003 -3.5355338e-003 -4.1424935e+0037.4161819e+003
-3.6257613e-003 -3.4429429e-0035.1674583e+0036.6689286e+003
3.6257615e-003 -3.4429431e-003 -4.0921611e+0037.5593835e+003
-3.7142795e-003 -3.3472572e-0036.5670222e+0036.6475534e+003
3.7142793e-003 -3.3472569e-003 -4.1258927e+0037.6816751e+003
-3.8007998e-003 -3.2486799e-0038.0027402e+0036.6329097e+003
3.8007996e-003 -3.2486799e-003 -4.2083961e+0037.8019047e+003
-3.8850475e-003 -3.1474447e-0039.4417815e+0036.6134982e+003
3.8850475e-003 -3.1474445e-003 -4.2802750e+0037.9312016e+003
-3.9667669e-003 -3.0438071e-0031.0885697e+0046.6001057e+003
3.9667669e-003 -3.0438069e-003 -4.3408835e+0037.9873097e+003
-4.0457221e-003 -2.9380494e-0031.2316969e+0046.5823228e+003
4.0457221e-003 -2.9380494e-003 -4.3317623e+0037.9887722e+003
-4.1217036e-003 -2.8304704e-0031.3737669e+0046.5711882e+003
4.1217031e-003 -2.8304704e-003 -4.2629002e+0037.9721606e+003
-4.1945283e-003 -2.7213846e-0031.5129904e+0046.5608264e+003
4.1945283e-003 -2.7213846e-003 -4.2054035e+0037.9930026e+003
-4.2640436e-003 -2.6111174e-0031.6498196e+0046.5534585e+003
4.2640436e-003 -2.6111174e-003 -4.1113847e+0037.9640791e+003
-4.3301275e-003 -2.5000002e-0031.7828841e+0046.5476594e+003
4.3301275e-003 -2.5000002e-003 -3.9876872e+0037.8774084e+003
-4.3933159e-003 -2.3872114e-0031.9130151e+0046.5425775e+003
4.3933159e-003 -2.3872112e-003 -3.8869883e+0037.7838156e+003
-4.4540525e-003 -2.2718757e-0032.0400491e+0046.5384799e+003
4.4540521e-003 -2.2718757e-003 -3.8370101e+0037.6840983e+003
-4.5121107e-003 -2.1542646e-0032.1639360e+0046.5346164e+003
4.5121107e-003 -2.1542646e-003 -3.8151976e+0037.6127225e+003
-4.5672869e-003 -2.0346732e-0032.2835421e+0046.5326599e+003
4.5672869e-003 -2.0346732e-003 -3.8025873e+0037.5556410e+003
-4.6193977e-003 -1.9134174e-0032.3984451e+0046.5309293e+003
4.6193972e-003 -1.9134174e-003 -3.7777188e+0037.5172782e+003
-4.6682907e-003 -1.7908280e-0032.5077196e+0046.5300313e+003
4.6682907e-003 -1.7908278e-003 -3.7515079e+0037.4849885e+003
-4.7138394e-003 -1.6672492e-0032.6108004e+0046.5303379e+003
4.7138394e-003 -1.6672491e-003 -3.7145324e+0037.4186384e+003
-4.7559491e-003 -1.5430320e-0032.7073790e+0046.5315074e+003
4.7559487e-003 -1.5430320e-003 -3.6254654e+0037.2800561e+003
-4.7945566e-003 -1.4185300e-0032.7967072e+0046.5342194e+003
4.7945566e-003 -1.4185300e-003 -3.5182110e+0037.1295109e+003
-4.8296293e-003 -1.2940953e-0032.8794187e+0046.5370990e+003
4.8296293e-003 -1.2940953e-003 -3.3946007e+0036.9855539e+003
-4.8614726e-003 -1.1687954e-0032.9550653e+0046.5398062e+003
4.8614722e-003 -1.1687954e-003 -3.2465282e+0036.8561955e+003
-4.8902892e-003 -1.0416699e-0033.0242485e+0046.5439166e+003
4.8902892e-003 -1.0416699e-003 -3.1192143e+0036.7664855e+003
-4.9159294e-003 -9.1303955e-0043.0861564e+0046.5494461e+003
4.9159294e-003 -9.1303955e-004 -3.0051861e+0036.6874456e+003
-4.9382723e-003 -7.8324281e-0043.1409726e+0046.5606419e+003
4.9382723e-003 -7.8324275e-004 -2.9224405e+0036.6551729e+003
-4.9572247e-003 -6.5263099e-0043.1873119e+0046.5713190e+003
4.9572247e-003 -6.5263093e-004 -2.8930901e+0036.6169673e+003
-4.9727228e-003 -5.2156451e-0043.2249736e+0046.5833478e+003
4.9727228e-003 -5.2156451e-004 -2.9010829e+0036.5677856e+003
-4.9847350e-003 -3.9040763e-0043.2546838e+0046.5844399e+003
4.9847346e-003 -3.9040763e-004 -2.9201035e+0036.5409760e+003
-4.9932608e-003 -2.5952412e-0043.2735746e+0046.5874609e+003
4.9932608e-003 -2.5952412e-004 -2.9294118e+0036.5203703e+003
-4.9983291e-003 -1.2927217e-0043.2855986e+0046.5913124e+003
4.9983291e-003 -1.2927217e-004 -2.9066729e+0036.5741405e+003
-5.0000004e-003 -2.1050218e-0183.2894928e+0046.5880093e+003
5.0000004e-003 -4.4253118e-019 -2.8685861e+0036.7060834e+003
-4.9983291e-0031.2927217e-0043.2873330e+0046.5873009e+003
4.9983291e-0031.2927217e-004 -2.8500288e+0036.8924361e+003
-4.9932608e-0032.5952412e-0043.2772173e+0046.5938388e+003
4.9932608e-0032.5952412e-004 -2.7939610e+0037.0852083e+003
-4.9847350e-0033.9040763e-0043.2585784e+0046.6073794e+003
4.9847346e-0033.9040763e-004 -2.7246341e+0037.2855970e+003
-4.9727228e-0035.2156451e-0043.2281401e+0046.6187253e+003
4.9727228e-0035.2156451e-004 -2.6930005e+0037.4806194e+003
-4.9572247e-0036.5263099e-0043.1899624e+0046.6312183e+003
4.9572247e-0036.5263093e-004 -2.7295352e+0037.6011977e+003
-4.9382723e-0037.8324281e-0043.1434210e+0046.6401215e+003
4.9382723e-0037.8324275e-004 -2.8007725e+0037.7146043e+003
-4.9159294e-0039.1303955e-0043.0886546e+0046.6485604e+003
4.9159294e-0039.1303955e-004 -2.8956416e+0037.8146412e+003
-4.8902892e-0031.0416699e-0033.0276015e+0046.6571098e+003
4.8902892e-0031.0416699e-003 -3.0135545e+0037.9062341e+003
-4.8614726e-0031.1687954e-0032.9585836e+0046.6673620e+003
4.8614722e-0031.1687954e-003 -3.1290702e+0037.9855313e+003
-4.8296293e-0031.2940953e-0032.8837438e+0046.6778814e+003
4.8296293e-0031.2940953e-003 -3.2543823e+0038.0696435e+003
-4.7945566e-0031.4185300e-0032.8013972e+0046.6897891e+003
4.7945566e-0031.4185300e-003 -3.3843930e+0038.1703916e+003
-4.7559491e-0031.5430320e-0032.7122142e+0046.6986793e+003
4.7559487e-0031.5430320e-003 -3.5321954e+0038.2717080e+003
-4.7138394e-0031.6672492e-0032.6159867e+0046.7125756e+003
4.7138394e-0031.6672491e-003 -3.6352449e+0038.4008878e+003
-4.6682907e-0031.7908280e-0032.5133278e+0046.7232598e+003
4.6682907e-0031.7908278e-003 -3.7189094e+0038.5199261e+003
-4.6193977e-0031.9134174e-0032.4048718e+0046.7369337e+003
4.6193972e-0031.9134174e-003 -3.7944438e+0038.6144584e+003
-4.5672869e-0032.0346732e-0032.2908180e+0046.7512863e+003
4.5672869e-0032.0346732e-003 -3.8464702e+0038.6781221e+003
-4.5121107e-0032.1542646e-0032.1718274e+0046.7651408e+003
4.5121107e-0032.1542646e-003 -3.9272030e+0038.6616790e+003
-4.4540525e-0032.2718757e-0032.0486778e+0046.7834139e+003
4.4540521e-0032.2718757e-003 -4.0209709e+0038.6130570e+003
-4.3933159e-0032.3872114e-0031.9220841e+0046.7986641e+003
4.3933159e-0032.3872112e-003 -4.0957996e+0038.5634514e+003
-4.3301275e-0032.5000002e-0031.7927366e+0046.8213563e+003
4.3301275e-0032.5000002e-003 -4.1271279e+0038.5374009e+003
-4.2640436e-0032.6111174e-0031.6602504e+0046.8378431e+003
4.2640436e-0032.6111174e-003 -4.0966600e+0038.5651914e+003
-4.1945283e-0032.7213846e-0031.5242586e+0046.8617884e+003
4.1945283e-0032.7213846e-003 -4.0366310e+0038.6098397e+003
-4.1217036e-0032.8304704e-0031.3853958e+0046.8828133e+003
4.1217031e-0032.8304704e-003 -3.9721255e+0038.6832715e+003
-4.0457221e-0032.9380494e-0031.2440815e+0046.9089055e+003
4.0457221e-0032.9380494e-003 -3.9242866e+0038.7306474e+003
-3.9667669e-0033.0438071e-0031.1014430e+0046.9337246e+003
3.9667669e-0033.0438069e-003 -3.8923938e+0038.7519093e+003
-3.8850475e-0033.1474447e-0039.5822049e+0036.9623295e+003
3.8850475e-0033.1474445e-003 -3.8343232e+0038.8246227e+003
-3.8007998e-0033.2486799e-0038.1510896e+0036.9902672e+003
3.8007996e-0033.2486799e-003 -3.7978648e+0038.8869670e+003
-3.7142795e-0033.3472572e-0036.7287327e+0037.0209455e+003
3.7142793e-0033.3472569e-003 -3.7402378e+0038.9222844e+003
-3.6257615e-0033.4429431e-0035.3291365e+0037.0509511e+003
3.6257615e-0033.4429431e-003 -3.6388158e+0038.9169480e+003
-3.5355338e-0033.5355338e-0033.9743655e+0037.0798278e+003
3.5355338e-0033.5355338e-003 -3.5787129e+0038.8228267e+003
-3.4429429e-0033.6257613e-0032.5863974e+0037.1149653e+003
3.4429431e-0033.6257615e-003 -3.5478562e+0038.6842794e+003
-3.3472572e-0033.7142795e-0031.2235209e+0037.1518668e+003
3.3472572e-0033.7142795e-003 -3.5284680e+0038.5151642e+003
-3.2486799e-0033.8007998e-003 -6.8530366e+0017.1940318e+003
3.2486799e-0033.8007998e-003 -3.5206756e+0038.4100039e+003
-3.1474447e-0033.8850475e-003 -1.3336137e+0037.2394715e+003
3.1474447e-0033.8850475e-003 -3.4788619e+0038.3705545e+003
-3.0438071e-0033.9667669e-003 -2.5559883e+0037.2891786e+003
3.0438071e-0033.9667669e-003 -3.3408608e+0038.4008323e+003
-2.9380494e-0034.0457221e-003 -3.7253294e+0037.3394684e+003
2.9380494e-0034.0457221e-003 -3.1523890e+0038.5357694e+003
-2.8304704e-0034.1217036e-003 -4.8327285e+0037.3963521e+003
2.8304704e-0034.1217036e-003 -3.0494703e+0038.6509382e+003
-2.7213846e-0034.1945283e-003 -5.8699646e+0037.4542131e+003
2.7213846e-0034.1945283e-003 -3.0805056e+0038.6896743e+003
-2.6111174e-0034.2640436e-003 -6.8264478e+0037.5186734e+003
2.6111174e-0034.2640436e-003 -3.2332511e+0038.6562748e+003
-2.5000002e-0034.3301275e-003 -7.6997899e+0037.5883684e+003
2.5000002e-0034.3301275e-003 -3.4658365e+0038.6305420e+003
-2.3872114e-0034.3933159e-003 -8.4830058e+0037.6606402e+003
2.3872114e-0034.3933159e-003 -3.6884332e+0038.6015508e+003
-2.2718757e-0034.4540525e-003 -9.1769797e+0037.7430386e+003
2.2718757e-0034.4540525e-003 -3.8375595e+0038.6310153e+003
-2.1542646e-0034.5121107e-003 -9.7798454e+0037.8269068e+003
2.1542646e-0034.5121107e-003 -3.9043340e+0038.7198929e+003
-2.0346732e-0034.5672869e-003 -1.0276269e+0047.9217512e+003
2.0346732e-0034.5672869e-003 -3.8930208e+0038.7182576e+003
-1.9134174e-0034.6193977e-003 -1.0654758e+0048.0261885e+003
1.9134174e-0034.6193977e-003 -3.7454482e+0038.5048770e+003
-1.7908280e-0034.6682907e-003 -1.0904463e+0048.1464170e+003
1.7908280e-0034.6682907e-003 -3.5311315e+0038.2070183e+003
-1.6672492e-0034.7138394e-003 -1.1038011e+0048.2662723e+003
1.6672492e-0034.7138394e-003 -3.4206459e+0038.1044675e+003
-1.5430320e-0034.7559491e-003 -1.1058419e+0048.3779895e+003
1.5430320e-0034.7559491e-003 -3.4684240e+0038.0618193e+003
-1.4185300e-0034.7945566e-003 -1.0940758e+0048.5102779e+003
1.4185300e-0034.7945566e-003 -3.5779465e+0037.9736799e+003
-1.2940953e-0034.8296293e-003 -1.0720977e+0048.6193341e+003
1.2940953e-0034.8296293e-003 -3.7272404e+0037.9132296e+003
-1.1687954e-0034.8614726e-003 -1.0404881e+0048.7220827e+003
1.1687954e-0034.8614726e-003 -3.8563899e+0037.8541391e+003
-1.0416699e-0034.8902892e-003 -1.0031814e+0048.7911107e+003
1.0416699e-0034.8902892e-003 -3.8194336e+0037.7355688e+003
-9.1303955e-0044.9159294e-003 -9.5750884e+0038.8671024e+003
9.1303955e-0044.9159294e-003 -3.7042278e+0037.7416211e+003
-7.8324281e-0044.9382723e-003 -9.0148785e+0038.9660988e+003
7.8324281e-0044.9382723e-003 -3.6729812e+0037.8804391e+003
-6.5263099e-0044.9572247e-003 -8.4651722e+0038.9998977e+003
6.5263099e-0044.9572247e-003 -3.7989095e+0038.0535103e+003
-5.2156451e-0044.9727228e-003 -7.8839139e+0039.0513113e+003
5.2156451e-0044.9727228e-003 -4.0566495e+0038.2047738e+003
-3.9040763e-0044.9847350e-003 -7.3122775e+0039.0923017e+003
3.9040763e-0044.9847350e-003 -4.3899255e+0038.3623998e+003
-2.5952412e-0044.9932608e-003 -6.7891984e+0039.0172595e+003
2.5952412e-0044.9932608e-003 -4.7703820e+0038.5238215e+003
-1.2927217e-0044.9983291e-003 -6.2480568e+0038.9172962e+003
1.2927217e-0044.9983291e-003 -5.2589124e+0038.6376002e+003
-8.6783054e-0195.0000004e-003 -5.7606351e+0038.7899258e+003
没人理啊 问题已解决,在仿真论坛
http://forum.simwe.com/thread-1079624-1-1.html 本帖最后由 ChaChing 于 2013-5-25 22:18 编辑
guohf 发表于 2013-5-25 14:25 http://forum.chinavib.com/static/image/common/back.gif
没人理啊
不是没人理!
LZ没发现有人下载过资料吗? (但真好像只有一人)LZ没发现有人回应LZ的报到帖?
最近需学习没概念的领域软件及测试设备的熟悉使用, 单位线上又出了一些状况, 剩餘时间无几, 即使上振动也花在其他版块学习了
笔电上的matlab还真的许久未打开练习
昨晚上就拿LZ这简单的问题, 练习下已经生锈且"力不从心"的软件
大概都已发现问题打了些意见準备回覆, 只不过为了查些资讯先上了Simwe, 就已经发现马牛人已经早十几鐘前回覆了
相信马老弟应该也在这裡看过LZ的帖子, 我就决定摆著看看最后的反应与结果
结果跟个人预期差不多, 但远离个人的期望
问题已解决
真的吗? 个人是执负面的观点! 还真有些心灰意冷的感觉 纵坐标肯定是要归一化的,但是曲线形状大致没错,我就没细看了,老哥感觉有问题吗?因为我只给了个大致意思,数据估计不全,因为图中有多条曲线,提供的数据只有两组。 bainhome 发表于 2013-5-25 22:40 static/image/common/back.gif
纵坐标肯定是要归一化的,但是曲线形状大致没错,我就没细看了,老哥感觉有问题吗?因为我只给了个大致意思 ...
可能又没说清楚了(真是的, 以后会多打几个字! sorry)
不是指你没帮LZ解决问题! 而是指LZ其实还留著许多问题
反正假日坐等LZ回应!
可能原来没说清楚造成马兄弟误会, 真有些过意不去! 本想若LZ没回应(个人预期会如此), 就省事懒得说了, 反正干卿何事!
现在好像不说清楚还真不行了! 的确真的有些"力不从心"了, 眼睛花的厉害, 打字真有些吃力!(都150%!) 真是自作自受! 应该乖乖当我的看倌好好的学习便是, 何况没什麼硬实力, 该要学的还真多
为何说还存在问题? 或许仅是个人看法而已, 或许过於吹毛求疵!
再次重申不是指高手们没帮LZ解决问题!
长期来我好像看到一个现象, 许多人只要有程序可通了, 就不管原来自编的程序错在哪裡的!? 别忘记那是高手给的程序, 当然精湛可执行!
但个人以为, 清楚了解自编的程序错在那裡才是最基本的! 毕竟下次编程还是得自己来, 除非根本无此準备或心态! 若不关心自编的程序错在那裡, 那些错误不就一直存在吗? 敢问下如此真的会踏实吗? 对自己编程功力会真的有进步吗?
当然若能直接学习到高人的方式, 也不是不可, 只不过并非每个人都可以达到如此境界
所以个人一直以为若能知道原来错在哪裡, 才是真正解决问题! 当然我指的问题不仅是一般表面上的!
总之我要强调的重点, 不在有无实力或程度去学会那精湛的程序(这因人而异,改变有限), 而是在於有无那排误的学习态度! 个人感官迟钝, 还真没能察觉有存在这些态度!?
个人不才,不知有无交代清楚!? (做错事录口供~^~)
本帖最后由 ChaChing 于 2013-5-27 08:55 编辑
以下便是本来要po的东东, 本想算了(没营养又顾人怨!), 但还是…,恳请LZ与看倌包涵了
针对LZ的程序, 其中隐藏了不少问题! 就说说个人自以为是真正解决问题的过程或方式吧
1.建议养成好习惯,多看下Workspace及Help中的资讯
a)若看下Workspace, 就会发现ang是240*2,me是240*1!
b)如此plot(ang,me)其实是画了两条线! 等同plot(ang(:,1),me); hold on; plot(ang(:,2),me); 只不过第二条线几乎与y轴重合了! 可以修改那两个绘图指令成plot(ang,me,'o'); plot(ang,st,'o');便会很容易发现
c)追究ang为何是240*2, 不难发现是ang=的错用! 我想LZ是要Preallocation,那就应该是ang=zeros();吧!
2.建议多点开变数内容(使用双击)看看!
a)若看过x变数, 不难发现要画的x轴并非单调增加! (或者使用issorted检查)
b)如此是LZ要的吗? 若不是, 是否需考虑下先排序下或不画线!? 排序请help下sort或sortrows, 不画线类似上头检查图形的用法
3.建议养成好习惯,使用函数前先查下help并小试一下
a)若看过asin/acos的help, 不难发现asin/acos的输出范围分别是-pi/2~pi/2及0~pi, 那就需小心使用於各个象限
b)从先排序或不画线下的图形, 不难发现原写法產生非单值对应, 若LZ确认输入为一对一, 那就一定是用错了函数(可别如同某些人竟怀疑matlab函数)
c)要用对函数, 数学底子强的人或许直接即可应用正确, 但若如同个人水平一般的, 也可使用asind(1/2), acosd(1/2),asind(-1/2),acosd(-1/2)检验下, 不是吗
d)原来的逻辑判断未考虑出现零的情况, 很幸运LZ的原始座标点并无此状况
e)建议儘可能採用同一函数判断, 一下asin一下acos, 不是把问题复杂化, 个人以为一般人愈简化愈不会出错
f)另因为asin或acos的范围未含盖全域, 使得必须考虑较多, 若能多花些时间搜下help, 应该可以发现atan2或许更适用, 当然cart2pol及angle应该也可以
4.明明是一维的变数, 干嘛要使用二维的表示方式! 这样程序看起来很复杂, 一复杂化应该就容易出错吧!
5.xlabel('\it\theta^\o')
这些都是不难的错误(因为连老头都查到了), 相信LZ仔细点也可以自我发现! 只不过LZ好像浪费了一次自我排误的经验! 窃以为自我排误经验愈多, 编程能力自然提昇!
clear; clc;
load z02ms.dat; x=z02ms(:,1); y=z02ms(:,2); me=z02ms(:,3); st=z02ms(:,4);
=size(z02ms); r=abs(sqrt(x.^2+y.^2)); ang=zeros(m,1);
for i=1:m, temp=asind(y(i)/r(i)); acs=acosd(y(i)/r(i));
if x(i)>=0 && y(i)>=0, ang(i)=temp;
elseif x(i)<0 && y(i)>=0, ang(i)=90+acs; % ang(i)=180-temp;
elseif x(i)<=0 && y(i)<0, ang(i)=180-temp;
else ang(i)=450-acs; % ang(i)=360+temp;
end
end
%% ang=atan2(y,x)*180/pi; ii=ang<0; ang(ii)=ang(ii)+360; %3~10行可更改成这一行
=sortrows(ang); me=me(indx); st=st(indx);
subplot 211, plot(ang,me); grid on
xlabel('\it\theta^\o');ylabel('mean pressure'); title('mean pressure ');
subplot 212, plot(ang,st); grid on
xlabel('\it\theta^\o');ylabel('Fluctuating pressure'); title('Fluctuating pressure rms'); 另外可否请教下, 这是CFD的结果吗?
若是的话, 比较好奇的是, 怎麼Cp左右不对称? ChaChing 发表于 2013-5-26 22:21 static/image/common/back.gif
另外可否请教下, 这是CFD的结果吗?
若是的话, 比较好奇的是, 怎麼Cp左右不对称?
非常感谢ChaChing的指正和帮助。
我的数据是CFD的圆柱绕流的圆柱表面压力结果,左右不太对称了。因要处理得到这些数据就编程弄了好长时间(说实话,我的matlab都是边用边学的),因为数据顺序很乱,画出来的图也有好多线,当时没意识到应用sortrows对点排下序,还以为是角度转换的不对,就一直在改这个,所以才会有asind和acosd等,把问题搞复杂了。
各位论友可能没注意到,我在三楼已说了,问题在仿真论坛里解决了,问题很简单,是我把问题复杂化了。
http://forum.simwe.com/thread-1079624-1-1.html
ChaChing在9楼对程序的评论及怎样排误让我受意非浅,以后也会自己排错了。
真的很感谢ChaChing,每次有问题,ChaChing都会热心帮忙解决的 ChaChing 发表于 2013-5-26 22:06 static/image/common/back.gif
以下便是本来要po的东东, 本想算了(没营养又顾人怨!), 但还是…,恳请LZ与看倌包涵了
针对LZ的程序, 其中 ...
如你所说,检查我的原程序,真的问题多多,连最简单的矩阵表示都写错了,本来想要ang为一m行1列矩阵(可用空矩阵[]代替),却写成了,得到240*2的阵。
因以前处理的数据都是有序的,就没想到是数据太乱的事,其实atan2、cart2pol等函数我都试过,也知道这些反函数的范围,因一直得不到结果,就以为是角度转换的问题,真应把角度显示一下,不过原程序即使sortrows后,在第一象限里也有重复,我会再查一下出错原因的。
ChaChing说的很好,不能高手给了程序就不管原程序错在那了,这样什么时候都进步不了。 guohf 发表于 2013-5-27 11:06 static/image/common/back.gif
如你所说,检查我的原程序,真的问题多多,连最简单的矩阵表示都写错了,本来想要ang为一m行1列矩阵(可用 ...
还好LZ听了下, 白担心了!
LZ的状况是学习过程的正常现象, 个人以为不怕问题过於简单, 只怕不想用心学习
反正个人只希望大家可以共同提升
本帖最后由 guohf 于 2013-5-28 09:51 编辑
ChaChing 发表于 2013-5-27 11:34 static/image/common/back.gif
还好LZ听了下, 白担心了!
LZ的状况是学习过程的正常现象, 个人以为不怕问题过於简单, 只怕不想用心学习
...
谢谢ChaChing。
据你9楼的指点,我查了一下,原程序在角度转换上有很大问题,还没理好错在那(等忙过这两天好好找下原因),所以你在9楼基于我原程序而修改的程序图形结果也不对。仿真里的结果才对。程序(稍微修改了一下):
load z02ms.dat
data=z02ms
=cart2pol(data(:,1),data(:,2));
theta=the*180/pi;
dx=;
dx=sortrows(dx);
plot(dx(:,1)+180,dx(:,2))
guohf 发表于 2013-5-28 09:50 static/image/common/back.gif
谢谢ChaChing。
据你9楼的指点,我查了一下,原程序在角度转换上有很大问题,还没理好错在那(等忙过这两 ...
可能LZ还没空细看!
我与bainhome的图形结果本质是一样的! 只不过atan2及cart2pol的输出范围是-pi~pi, 我已经依LZ需求转换为(0~360)
9F有给了atan2的方式, 但我有将-pi~0转换至pi~2*pi, 若不转换就完全与bainhome的图形结果是一样了
其实另一盲点, 在打字时又忘记提醒了!
一般习惯好像flow都是由左流向右, 所以请注意下LZ的零点是否与文献相对
9F程序是以右边为零度
另bainhome所谓的平移, 应该不是LZ所谓的+180
这个观念(+180)是有问题的, 之所以图形类似是因LZ给的数据刚好对称(没空检验,不确定), 若不是就错了
页:
[1]
2