remove inf in quiver
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
I want quiver(X,Y,u,v), but there's inf entries in u and v at positions x=y. I'm looking for the smartest way to skip these positions with inf u and v and finish the quiver.
x=-5:0.1:5;
y=-5:0.1:5;
[X,Y]=meshgrid(x,y);
댓글 수: 1
Dyuman Joshi
2024년 4월 28일
u and v aren't defined in the code.
채택된 답변
Star Strider
2024년 4월 28일
1 개 추천
Without having ‘u’ and ‘v’ to work with, perhaps something like this using fillmissing (or fillmissing2) —
x=-5:0.1:5;
y=-5:0.1:5;
[X,Y]=meshgrid(x,y);
u = randn(size(X)); % Create 'u'
ix = sub2ind(size(u), 1:size(u,1), 1:size(u,2)); % Linear Inmdex To Create 'u' With Diagnonal 'Inf'
u(ix) = Inf
u = 101x101
Inf -1.4193 1.0497 -0.1100 0.2181 -2.3272 -0.1111 0.6233 -0.4594 0.1195 0.9566 -1.9244 -1.4146 -0.4970 0.0888 1.9743 0.4177 -0.6746 1.0932 1.6275 -0.3020 2.6394 0.0664 -0.9736 0.5496 0.9406 0.7607 -1.1810 0.1057 0.3238
-0.2040 Inf 1.4676 -0.4032 -0.8914 0.6347 0.2933 -0.7958 -0.5473 0.3441 -1.0796 -0.2790 -0.8720 -0.1744 1.0271 0.2945 -0.6075 -0.3061 0.9589 -0.3907 -0.1497 -0.5693 1.9353 -0.9865 1.5239 0.9541 1.2692 0.5700 0.6326 -0.2809
0.4440 0.1059 Inf -0.7628 -1.9011 0.4484 -0.6286 -0.0539 -0.9827 -0.1590 -1.1202 0.9885 -0.1086 -0.2550 0.5774 -0.3649 0.9951 0.3727 0.7720 0.5775 1.4696 -0.2848 0.2413 -0.7008 -1.0953 -1.5702 -0.5243 -0.0585 -2.2009 -2.7097
-1.1253 -0.7258 -0.8600 Inf -0.7818 0.0430 1.3831 0.4638 -1.8246 -0.5975 1.1344 -2.0120 0.3844 -1.4048 -0.7412 -0.7979 -0.3750 1.3553 -0.5779 0.0419 0.5819 1.2048 -0.7356 -0.4025 -0.4867 -2.7108 -0.5462 -0.5905 0.7864 -1.9629
0.7305 1.5534 0.0548 0.6495 Inf 0.9854 0.1087 0.1832 0.1335 2.4604 -0.5619 2.5730 0.3904 1.0272 -0.4547 1.0581 0.3803 0.3861 -0.6168 1.0308 -1.0501 1.1463 -0.4087 -0.2244 -1.0732 1.3175 -0.1320 0.2752 0.8637 -0.0700
1.5087 0.2137 -0.5525 0.6823 1.3532 Inf -0.9245 0.0744 -0.7550 -1.0429 -0.4523 0.1324 0.3328 0.8958 -0.8247 0.0939 -0.9691 -0.3163 0.4888 -0.2547 2.0617 -1.2665 -1.3080 -0.2838 0.4716 0.0971 1.3410 0.4530 -0.5502 -0.3113
-0.7899 -1.3514 1.8762 1.4511 -0.6696 0.6343 Inf 0.5961 0.5598 1.2437 0.3595 -0.3161 0.0932 1.3476 -1.0957 0.1353 0.3317 -1.3635 0.9710 1.6089 -1.9098 0.8884 0.3416 0.1062 0.8726 1.1483 -0.3553 -0.5328 -0.2019 -0.8153
0.7720 0.5451 0.7223 -1.8662 -0.6066 -0.0011 1.0699 Inf -0.3192 1.2113 -0.9188 -0.0333 -0.5733 0.0934 -0.1295 1.4446 -1.1444 1.1519 -0.9562 -0.6240 -0.0261 0.5102 -1.5159 -0.8370 0.7812 1.1397 0.1271 0.5030 -0.8183 1.9334
-1.0089 -1.5652 0.4866 -1.7667 0.1231 0.1948 -1.0970 -0.6456 Inf 0.6980 -1.0084 0.9558 -1.3121 -0.8189 -1.0246 -0.6636 -1.7755 0.1567 0.6217 -0.1159 0.8454 -0.0712 1.8066 -0.7937 0.6682 -0.0229 -1.0841 1.5203 -1.2465 -1.5232
0.1843 1.4161 1.2349 -1.0478 -0.4456 0.2213 0.2403 -0.9400 0.1554 Inf -0.4139 -1.0749 -0.7384 -1.5659 1.6817 -1.2396 -0.7250 0.3642 -0.1862 0.4102 1.0891 -0.9765 0.1297 1.0545 -0.4711 -0.9109 -1.2133 0.7924 -0.2372 -0.9673
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
u(isinf(u)) = NaN % Change 'Inf' To 'NaN'
u = 101x101
NaN -1.4193 1.0497 -0.1100 0.2181 -2.3272 -0.1111 0.6233 -0.4594 0.1195 0.9566 -1.9244 -1.4146 -0.4970 0.0888 1.9743 0.4177 -0.6746 1.0932 1.6275 -0.3020 2.6394 0.0664 -0.9736 0.5496 0.9406 0.7607 -1.1810 0.1057 0.3238
-0.2040 NaN 1.4676 -0.4032 -0.8914 0.6347 0.2933 -0.7958 -0.5473 0.3441 -1.0796 -0.2790 -0.8720 -0.1744 1.0271 0.2945 -0.6075 -0.3061 0.9589 -0.3907 -0.1497 -0.5693 1.9353 -0.9865 1.5239 0.9541 1.2692 0.5700 0.6326 -0.2809
0.4440 0.1059 NaN -0.7628 -1.9011 0.4484 -0.6286 -0.0539 -0.9827 -0.1590 -1.1202 0.9885 -0.1086 -0.2550 0.5774 -0.3649 0.9951 0.3727 0.7720 0.5775 1.4696 -0.2848 0.2413 -0.7008 -1.0953 -1.5702 -0.5243 -0.0585 -2.2009 -2.7097
-1.1253 -0.7258 -0.8600 NaN -0.7818 0.0430 1.3831 0.4638 -1.8246 -0.5975 1.1344 -2.0120 0.3844 -1.4048 -0.7412 -0.7979 -0.3750 1.3553 -0.5779 0.0419 0.5819 1.2048 -0.7356 -0.4025 -0.4867 -2.7108 -0.5462 -0.5905 0.7864 -1.9629
0.7305 1.5534 0.0548 0.6495 NaN 0.9854 0.1087 0.1832 0.1335 2.4604 -0.5619 2.5730 0.3904 1.0272 -0.4547 1.0581 0.3803 0.3861 -0.6168 1.0308 -1.0501 1.1463 -0.4087 -0.2244 -1.0732 1.3175 -0.1320 0.2752 0.8637 -0.0700
1.5087 0.2137 -0.5525 0.6823 1.3532 NaN -0.9245 0.0744 -0.7550 -1.0429 -0.4523 0.1324 0.3328 0.8958 -0.8247 0.0939 -0.9691 -0.3163 0.4888 -0.2547 2.0617 -1.2665 -1.3080 -0.2838 0.4716 0.0971 1.3410 0.4530 -0.5502 -0.3113
-0.7899 -1.3514 1.8762 1.4511 -0.6696 0.6343 NaN 0.5961 0.5598 1.2437 0.3595 -0.3161 0.0932 1.3476 -1.0957 0.1353 0.3317 -1.3635 0.9710 1.6089 -1.9098 0.8884 0.3416 0.1062 0.8726 1.1483 -0.3553 -0.5328 -0.2019 -0.8153
0.7720 0.5451 0.7223 -1.8662 -0.6066 -0.0011 1.0699 NaN -0.3192 1.2113 -0.9188 -0.0333 -0.5733 0.0934 -0.1295 1.4446 -1.1444 1.1519 -0.9562 -0.6240 -0.0261 0.5102 -1.5159 -0.8370 0.7812 1.1397 0.1271 0.5030 -0.8183 1.9334
-1.0089 -1.5652 0.4866 -1.7667 0.1231 0.1948 -1.0970 -0.6456 NaN 0.6980 -1.0084 0.9558 -1.3121 -0.8189 -1.0246 -0.6636 -1.7755 0.1567 0.6217 -0.1159 0.8454 -0.0712 1.8066 -0.7937 0.6682 -0.0229 -1.0841 1.5203 -1.2465 -1.5232
0.1843 1.4161 1.2349 -1.0478 -0.4456 0.2213 0.2403 -0.9400 0.1554 NaN -0.4139 -1.0749 -0.7384 -1.5659 1.6817 -1.2396 -0.7250 0.3642 -0.1862 0.4102 1.0891 -0.9765 0.1297 1.0545 -0.4711 -0.9109 -1.2133 0.7924 -0.2372 -0.9673
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
u = fillmissing(u,'linear') % Use 'fillmissing'
u = 101x101
-0.8520 -1.4193 1.0497 -0.1100 0.2181 -2.3272 -0.1111 0.6233 -0.4594 0.1195 0.9566 -1.9244 -1.4146 -0.4970 0.0888 1.9743 0.4177 -0.6746 1.0932 1.6275 -0.3020 2.6394 0.0664 -0.9736 0.5496 0.9406 0.7607 -1.1810 0.1057 0.3238
-0.2040 -0.6567 1.4676 -0.4032 -0.8914 0.6347 0.2933 -0.7958 -0.5473 0.3441 -1.0796 -0.2790 -0.8720 -0.1744 1.0271 0.2945 -0.6075 -0.3061 0.9589 -0.3907 -0.1497 -0.5693 1.9353 -0.9865 1.5239 0.9541 1.2692 0.5700 0.6326 -0.2809
0.4440 0.1059 0.3038 -0.7628 -1.9011 0.4484 -0.6286 -0.0539 -0.9827 -0.1590 -1.1202 0.9885 -0.1086 -0.2550 0.5774 -0.3649 0.9951 0.3727 0.7720 0.5775 1.4696 -0.2848 0.2413 -0.7008 -1.0953 -1.5702 -0.5243 -0.0585 -2.2009 -2.7097
-1.1253 -0.7258 -0.8600 -0.0567 -0.7818 0.0430 1.3831 0.4638 -1.8246 -0.5975 1.1344 -2.0120 0.3844 -1.4048 -0.7412 -0.7979 -0.3750 1.3553 -0.5779 0.0419 0.5819 1.2048 -0.7356 -0.4025 -0.4867 -2.7108 -0.5462 -0.5905 0.7864 -1.9629
0.7305 1.5534 0.0548 0.6495 0.2857 0.9854 0.1087 0.1832 0.1335 2.4604 -0.5619 2.5730 0.3904 1.0272 -0.4547 1.0581 0.3803 0.3861 -0.6168 1.0308 -1.0501 1.1463 -0.4087 -0.2244 -1.0732 1.3175 -0.1320 0.2752 0.8637 -0.0700
1.5087 0.2137 -0.5525 0.6823 1.3532 0.8098 -0.9245 0.0744 -0.7550 -1.0429 -0.4523 0.1324 0.3328 0.8958 -0.8247 0.0939 -0.9691 -0.3163 0.4888 -0.2547 2.0617 -1.2665 -1.3080 -0.2838 0.4716 0.0971 1.3410 0.4530 -0.5502 -0.3113
-0.7899 -1.3514 1.8762 1.4511 -0.6696 0.6343 0.0727 0.5961 0.5598 1.2437 0.3595 -0.3161 0.0932 1.3476 -1.0957 0.1353 0.3317 -1.3635 0.9710 1.6089 -1.9098 0.8884 0.3416 0.1062 0.8726 1.1483 -0.3553 -0.5328 -0.2019 -0.8153
0.7720 0.5451 0.7223 -1.8662 -0.6066 -0.0011 1.0699 -0.0247 -0.3192 1.2113 -0.9188 -0.0333 -0.5733 0.0934 -0.1295 1.4446 -1.1444 1.1519 -0.9562 -0.6240 -0.0261 0.5102 -1.5159 -0.8370 0.7812 1.1397 0.1271 0.5030 -0.8183 1.9334
-1.0089 -1.5652 0.4866 -1.7667 0.1231 0.1948 -1.0970 -0.6456 -0.0819 0.6980 -1.0084 0.9558 -1.3121 -0.8189 -1.0246 -0.6636 -1.7755 0.1567 0.6217 -0.1159 0.8454 -0.0712 1.8066 -0.7937 0.6682 -0.0229 -1.0841 1.5203 -1.2465 -1.5232
0.1843 1.4161 1.2349 -1.0478 -0.4456 0.2213 0.2403 -0.9400 0.1554 0.8220 -0.4139 -1.0749 -0.7384 -1.5659 1.6817 -1.2396 -0.7250 0.3642 -0.1862 0.4102 1.0891 -0.9765 0.1297 1.0545 -0.4711 -0.9109 -1.2133 0.7924 -0.2372 -0.9673
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Use whatever interpolation method you want with fillmissing. There are several options.
.
댓글 수: 4
feynman feynman
2024년 4월 28일
That's wonderful thank you. Is it possible to just leave those inf blank where quiver skips? This code is to show a vector field, but replacing those inf with some random numbers varies the original vector field. I prefer showing the original vector field without changing it and skipping the inf.
Thank you!
The problem with leaving them blank is that reduces the matrix by 1 in the row size. That makes plotting them with the original (X,Y) matrices inpossible, unless you also delete the corresponding diagonal elements in the (X,Y) matrices.
One way to do that is to use a version of my original code for all the matrices —
x=-5:0.1:5;
y=-5:0.1:5;
[X,Y]=meshgrid(x,y)
X = 101x101
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Y = 101x101
-5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000
-4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000
-4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000
-4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000
-4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000
-4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000
-4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000
-4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000
-4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000
-4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
u = randn(size(X)) % Create 'u'
u = 101x101
1.0416 0.4976 -2.2880 -1.0695 -0.8975 -0.4864 0.4944 -1.0780 0.3432 -1.3906 -0.8808 -0.2443 -0.3013 -2.0142 0.9431 1.3709 0.2739 -0.2580 0.1103 -0.7482 -2.0283 0.2410 -1.1488 -0.6631 1.7010 -1.2080 -0.2023 -0.6565 1.0763 -0.0878
1.3527 1.4142 -0.0716 0.3693 1.1543 -0.5840 -0.5118 0.5214 0.4985 0.9944 -0.5191 -0.1141 -0.1074 0.6984 -0.3814 1.0227 0.1055 -1.2210 0.3175 0.8149 -0.3643 -0.1991 0.3324 -0.8687 -0.1069 1.3456 -0.9496 -2.1156 -0.2499 -0.1036
0.4042 1.1743 0.2479 -2.3132 0.1202 -0.7791 -0.0597 0.5700 2.8162 0.3367 -0.8705 -0.3162 0.7878 0.9872 0.3854 -1.1486 -0.6201 -0.5917 1.2014 1.3259 0.1597 -0.1633 -1.8826 1.6549 0.6298 -0.3307 -1.6883 1.7347 0.4500 -0.1470
-0.7712 0.4800 1.1768 -0.1610 1.9788 0.3717 -2.2490 -0.6272 -0.6400 0.0349 0.8406 -0.9202 -0.9976 0.2482 0.4563 1.1361 0.7043 0.8445 0.6107 1.7341 0.5329 0.3174 0.0295 -0.0537 -0.3833 1.5817 0.8829 -0.9185 -0.3143 -1.1993
0.8611 -2.1310 -0.0497 0.4518 -0.7790 0.9275 -1.5043 -0.1288 -1.7874 -0.5009 -1.2705 1.3980 -1.3038 0.2154 -0.4194 0.9504 -0.8425 -0.8133 1.0367 -0.2383 2.5223 1.0083 1.4929 -0.6683 0.3278 0.9372 -0.5033 -0.9065 -2.1159 0.2459
1.2965 -1.5650 -0.8090 -0.1178 1.5025 0.9455 -0.6591 -0.6878 0.7525 -0.1871 -1.1075 -1.2565 -0.0721 -2.1150 -0.7080 1.7625 -2.0217 -1.0684 0.0492 -0.2358 -0.1170 0.7115 1.0866 -1.9088 0.0407 0.4413 1.4944 -0.4083 -1.8841 -0.7866
0.5496 1.6776 0.4096 -0.4035 0.2178 -0.7906 -0.6781 -1.1891 0.3486 0.1296 -0.6972 -0.6551 -0.5619 1.0872 0.4286 -0.0118 1.6627 -1.0485 0.0341 -0.3043 1.4241 -1.2172 -2.2957 0.2514 -0.4173 -1.5030 1.0038 -0.9420 -1.4555 -1.8242
-0.7110 0.4111 -0.3904 1.8031 0.8705 -0.3651 0.2371 -1.9094 0.7863 -0.2426 1.3816 -0.4364 -1.1832 1.3150 -0.0649 -0.8644 -0.3579 -1.6717 -0.1891 -0.2216 1.0190 -1.6997 0.4288 0.3433 -0.9386 0.0676 -0.8425 -0.4357 0.2615 0.8959
-0.3203 0.7464 0.8151 -1.5330 0.3958 0.1805 -0.2196 0.4440 -1.2297 0.9078 1.0784 1.7844 -0.1735 1.2498 -0.7078 -0.7875 -0.0438 0.1261 0.2567 -0.1855 1.1591 1.3024 -1.2647 0.8526 0.5216 -0.0172 0.1848 0.7712 1.0400 0.6685
0.2125 -1.8611 0.1688 -0.4213 1.1177 -1.4098 -0.4382 -0.4309 -0.3949 -0.4577 0.2615 -0.4372 -0.0506 0.0360 -0.5793 -0.5615 1.1188 1.0681 0.0527 -0.6043 -0.3399 -1.3529 -0.3800 0.6060 -0.7423 -0.8488 0.0508 0.5837 0.2594 0.9917
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
ix = sub2ind(size(u), 1:size(u,1), 1:size(u,2)); % Linear Inmdex To Create 'u' With Diagnonal 'Inf'
X(ix) = [];
X = reshape(X,100,[])
X = 100x101
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000 -3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000 -2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Y(ix) = [];
Y = reshape(Y,100,[])
Y = 100x101
-4.9000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000 -5.0000
-4.8000 -4.8000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000 -4.9000
-4.7000 -4.7000 -4.7000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000 -4.8000
-4.6000 -4.6000 -4.6000 -4.6000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000 -4.7000
-4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000 -4.6000
-4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000 -4.5000
-4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000 -4.4000
-4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000 -4.3000
-4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000 -4.2000
-4.0000 -4.0000 -4.0000 -4.0000 -4.0000 -4.0000 -4.0000 -4.0000 -4.0000 -4.0000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000 -4.1000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
u(ix) = [];
u = reshape(u, 100,[])
u = 100x101
1.3527 0.4976 -2.2880 -1.0695 -0.8975 -0.4864 0.4944 -1.0780 0.3432 -1.3906 -0.8808 -0.2443 -0.3013 -2.0142 0.9431 1.3709 0.2739 -0.2580 0.1103 -0.7482 -2.0283 0.2410 -1.1488 -0.6631 1.7010 -1.2080 -0.2023 -0.6565 1.0763 -0.0878
0.4042 1.1743 -0.0716 0.3693 1.1543 -0.5840 -0.5118 0.5214 0.4985 0.9944 -0.5191 -0.1141 -0.1074 0.6984 -0.3814 1.0227 0.1055 -1.2210 0.3175 0.8149 -0.3643 -0.1991 0.3324 -0.8687 -0.1069 1.3456 -0.9496 -2.1156 -0.2499 -0.1036
-0.7712 0.4800 1.1768 -2.3132 0.1202 -0.7791 -0.0597 0.5700 2.8162 0.3367 -0.8705 -0.3162 0.7878 0.9872 0.3854 -1.1486 -0.6201 -0.5917 1.2014 1.3259 0.1597 -0.1633 -1.8826 1.6549 0.6298 -0.3307 -1.6883 1.7347 0.4500 -0.1470
0.8611 -2.1310 -0.0497 0.4518 1.9788 0.3717 -2.2490 -0.6272 -0.6400 0.0349 0.8406 -0.9202 -0.9976 0.2482 0.4563 1.1361 0.7043 0.8445 0.6107 1.7341 0.5329 0.3174 0.0295 -0.0537 -0.3833 1.5817 0.8829 -0.9185 -0.3143 -1.1993
1.2965 -1.5650 -0.8090 -0.1178 1.5025 0.9275 -1.5043 -0.1288 -1.7874 -0.5009 -1.2705 1.3980 -1.3038 0.2154 -0.4194 0.9504 -0.8425 -0.8133 1.0367 -0.2383 2.5223 1.0083 1.4929 -0.6683 0.3278 0.9372 -0.5033 -0.9065 -2.1159 0.2459
0.5496 1.6776 0.4096 -0.4035 0.2178 -0.7906 -0.6591 -0.6878 0.7525 -0.1871 -1.1075 -1.2565 -0.0721 -2.1150 -0.7080 1.7625 -2.0217 -1.0684 0.0492 -0.2358 -0.1170 0.7115 1.0866 -1.9088 0.0407 0.4413 1.4944 -0.4083 -1.8841 -0.7866
-0.7110 0.4111 -0.3904 1.8031 0.8705 -0.3651 0.2371 -1.1891 0.3486 0.1296 -0.6972 -0.6551 -0.5619 1.0872 0.4286 -0.0118 1.6627 -1.0485 0.0341 -0.3043 1.4241 -1.2172 -2.2957 0.2514 -0.4173 -1.5030 1.0038 -0.9420 -1.4555 -1.8242
-0.3203 0.7464 0.8151 -1.5330 0.3958 0.1805 -0.2196 0.4440 0.7863 -0.2426 1.3816 -0.4364 -1.1832 1.3150 -0.0649 -0.8644 -0.3579 -1.6717 -0.1891 -0.2216 1.0190 -1.6997 0.4288 0.3433 -0.9386 0.0676 -0.8425 -0.4357 0.2615 0.8959
0.2125 -1.8611 0.1688 -0.4213 1.1177 -1.4098 -0.4382 -0.4309 -0.3949 0.9078 1.0784 1.7844 -0.1735 1.2498 -0.7078 -0.7875 -0.0438 0.1261 0.2567 -0.1855 1.1591 1.3024 -1.2647 0.8526 0.5216 -0.0172 0.1848 0.7712 1.0400 0.6685
1.5556 0.3735 0.4183 -2.1705 0.7528 -0.4665 -0.0809 -1.3804 -0.6506 -1.0935 0.2615 -0.4372 -0.0506 0.0360 -0.5793 -0.5615 1.1188 1.0681 0.0527 -0.6043 -0.3399 -1.3529 -0.3800 0.6060 -0.7423 -0.8488 0.0508 0.5837 0.2594 0.9917
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Then do the same sort of operation with ‘v’.
Another (perhaps preferable) option is to leave them as NaN values. The NaN values will not plot, and any calculations involving them will also be NaN, however if there are any recursive operations involving the matrices, that could leave many more elements a NaN values.
As I mentioned earlier, fillmissing has other options to fill the NaN values if you want to use them, for example a constant value. Interpolating them using linear or other methods is not absolutely necessary.
.
feynman feynman
2024년 4월 29일
Thank you so much!
Star Strider
2024년 4월 29일
As always, my pleasure!
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
태그
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
