How to make the following shape in Matlab

Hello, I hope you are doing well. i Have attached the two files, i want to create the similar plot using Matlab
How can i do that?

15 Commenti

What is your input data and what have you tried?
@Rik my input data is the two picture i have attached. i want to create same plots.
@Rik i have updated the question now you can see the plots
Do you have the actual underlying data you want to plot? Because if you want the images, you already have them.
Do you have any data or do you want to create a plot from scratch?
@Rik @Dyuman Joshi No i have not any actual data , i have only the images , i want to create it from scratch
Sam Chak
Sam Chak il 31 Mag 2022
Modificato: Sam Chak il 31 Mag 2022
Then your lecturer/supervisor must be "torturing'' you...
It is still possible to plot the first one using some mathematical functions with a repetitive pattern.
The second one is bit tricky. But the function should look something like , where the function is related to the first one.
f(abs(s-4)) maybe?
Med Future
Med Future il 31 Mag 2022
Modificato: Med Future il 31 Mag 2022
@Sam Chak @Walter Roberson can you share any code solution for that? we can neglect x axis and y axis values
I do not have code for this.
Your second image involves three different pulses. The second and fourth are mirror images of each other. The first and the third are different: notice that the right leg of the third pulse descends further.
I am not prepared to mentally estimate the function, or to measure the pattern of changes in distance between points.
@Walter Roberson When you have free please try it.
@Med Future If you want to plot just these two images alone, then try this https://in.mathworks.com/matlabcentral/fileexchange/7173-grabit. This will let you extract the points from image and then you havde data in hand.
Sorry, this is not something I have an interest in doing.
Each of the pulses is slightly non-symmetric, some more obviously than others. Some are nearly the reverse of others.
The non-symmetry might possibly indicate that the pulse is symmetric but not sampled exactly symmetrical around the axis of symmetry.
The second pulse is roughly
p = [-1024/5, 7168/5, -12544/5]
x = linspace(3+3/16,3+13/16,32);
y = polyval(p, x);
plot(x, y)
daspect([1/2,5])

Accedi per commentare.

Risposte (1)

Sam Chak
Sam Chak il 31 Mag 2022
Modificato: Sam Chak il 31 Mag 2022
Edit: Make good use from @Walter Roberson's polynomial regression model of the second pulse from the OP's second image.
First Figure
s = [0 4 8]
p = [-1024/5, 7168/5, -12544/5];
for j = 1:length(s)
x(j, :) = linspace(s(j)+3/16, s(j)+13/16, 32);
y(j, :) = polyval(p, x(j, :)-(s(j)-3));
plot(x(j, :), y(j, :), 'linewidth', 1.5)
hold on
end
hold off
grid on
xlabel('s')
ylabel('PA')
Second Figure:
s = [0 3 4 7]
p = [-1024/5, 7168/5, -12544/5];
for j = 1:length(s)
x(j, :) = linspace(s(j)+3/16, s(j)+13/16, 32);
y(j, :) = polyval(p, x(j, :)-(s(j)-3));
plot(x(j, :), y(j, :), 'linewidth', 1.5)
hold on
end
hold off
grid on
xlabel('s')
ylabel('PA')

4 Commenti

I think a reverse parabola might suit better.
@Sam Chak it is not the i want, the shape is different from the image i have attached
Sam Chak
Sam Chak il 31 Mag 2022
Modificato: Sam Chak il 31 Mag 2022
Edit: Guessing the correct math functions without any useful info or unique features is like searching a needle in a haystack. Since you are unable to provide the data points, I guess this indefinite problem is beyond my capability. Good luck!

Accedi per commentare.

Categorie

Prodotti

Release

R2021b

Richiesto:

il 31 Mag 2022

Modificato:

il 31 Mag 2022

Community Treasure Hunt

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

Start Hunting!

Translated by