how to mirror data and then plot it?

この 質問 は dpb さんによってフラグが設定されました
  • dpb さんによって 2024 年 8 月 8 日 に 複製 としてフラグが設定されました。

    < https://in.mathworks.com/matlabcentral/answers/2143774-how-to-mirror-plots>

x =0:1:15;
y = tan(x);
plot(x,y)
i hv to mirror data and then plot also .how to do it

9 件のコメント

Aniket
Aniket 2024 年 8 月 8 日
編集済み: Aniket 2024 年 8 月 8 日
Hi @ramya, Can you please clarify what do you mean by mirroring data. Is it like you want 15..14..13...to.1 ? OR -1, -2, ...-15 ? Basically wrt what axis you want to mirror ?
ramya
ramya 2024 年 8 月 8 日
when i plot the results it plot should be symmetry and data also symmetry
Aniket
Aniket 2024 年 8 月 8 日
So I understand that you want to mirror along the middle.
Thus
x = 0:1:15;
y = tan(x);
x_new = x;
x_mirrored = fliplr(x_new);
and
y_new = tan(x_mirrored);
Thus the plot obtained will be
figure;
plot(x_new, y_new, 'b', 'DisplayName', 'Symmetric Data');
legend;
xlabel('x');
ylabel('tan(x)');
title('Symmetric Data Plot');
Let me know if this is what was desired.
ramya
ramya 2024 年 8 月 8 日
編集済み: dpb 2024 年 8 月 8 日
sir i hv to mirror it from center for example
a= [1 2 3 4 5 6 7 8 9 10] ;
b=[0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.2 0.3] ;
so keeping as threshold to center values
my data will be something
b=[0.2 0.3 0.4 0.5 0.6 0.5 0.4 0.3 0.2]
and then when i plot for b wrt a i get symmetry plots
Aniket
Aniket 2024 年 8 月 8 日
Something like this ?
ramya
ramya 2024 年 8 月 8 日
編集済み: ramya 2024 年 8 月 8 日
the image u showed above is exactly same plots i m looking for plz see the thread for data i m trying
dpb
dpb 2024 年 8 月 8 日
編集済み: dpb 2024 年 8 月 8 日
a= [1 2 3 4 5 6 7 8 9 10] ;
b=[0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.2 0.3] ;
ix=fix(numel(a)/2);
c=[b(1:ix) fliplr(b(1:ix))];
plot(a,c)
The above keeps the same number of elements as the original; to do your precise example reduces the number of points by one for an even number...your choice as to which would be the intent/need.
You still haven't precisely defined "symmetry about what?" for the original -- about the minimum, perhaps? That kind of thing may be very dependent upon just what the real application is, not just specifically for the one given example.
But a clear and unambiguous definition of just what "symmetrical" means to you is mandatory...
ramya
ramya 2024 年 8 月 8 日
thank u its similiar i m trying for this particular file pleae follow this thread data is present in this thread
dpb
dpb 2024 年 8 月 8 日
In that case, don't start a new and seemingly unrelated thread...what's wrong with the Answer @Cris LaPierre provided you there? Why don't you amplify in depth what "symmetry" is supposed to mean for the given data which look anything but as given?
It's not possible to answer a question when the specifications for the solution definition aren't clear...you may have a clear understanding of what you mean, but apparently nobody else here does...
I'm flagging this as duplicated to keep the conversation in one place and as a courtesy to those who responded there with best efforts...

回答 (0 件)

This question is locked.

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

製品

リリース

R2021b

タグ

質問済み:

2024 年 8 月 8 日

Locked:

2024 年 8 月 8 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by