How change the shape of plot ?

i have code for ploting data but the graph is not what i am looking for is like that
but i am looking for something like that which have 2D and countor graph and 3D togheter or 2D alone but detected all 3D structure with motion value
any one have any ideal i will upload the code and file for plotting
data = load('ST1.txt');
core = reshape(data(:, 3),100,100).';
subplot(3,1,1)
surf(real(core),'edgecolor', 'none')
subplot(3,1,2)
surf(imag(core),'edgecolor', 'none')
subplot(3,1,3)
surf(abs(core),'edgecolor', 'none')

3 Comments

data = load('ST1.txt');
There's something wrong w/ the attached file link; can't get access to it in the forum...normally that works just fine.
core = reshape(data(:, 3),100,100).';
subplot(3,1,1)
surf(real(core),'edgecolor', 'none')
subplot(3,1,2)
surf(imag(core),'edgecolor', 'none')
subplot(3,1,3)
surf(abs(core),'edgecolor', 'none')
@dpb I know it work but i want to change shape of graph ? How i can change the disign of graph?
I do not know what "change shape of graph" means. Change what shape from what to what?
You can design the graph to be whatever you wish but we can't read your mind in that regard. Again, change which specific graph design from what to what?

Sign in to comment.

Answers (1)

dpb
dpb on 18 Dec 2024
Edited: dpb on 18 Dec 2024
[X,Y,Z] = peaks(25);
surfc(X,Y,Z)
hold on
hAx(1)=gca;
pos=hAx(1).Position;
wh=diff(reshape(pos,2,[]).'); w=wh(1); h=wh(2);
l=pos(1); b=pos(2);
T=0.95; R=0.75;
hAx(2)=axes('Position',[l+T*w b+T*h (1-R)*w (1-R)*h],'Color','none');
hL=plot(hAx(2),X(ceil(25/2),:),Z(ceil(25/2),:),'k-','linewidth',2);
What is what you've done and what is what you're trying to do is hard to distinguish in the Question, but if the object is to get something approaching the Figure with the inset plot, the basic idea is above by placing a second axes on the same figure.
I'm not sure how the example there apparently has the edit tool icons visible...

7 Comments

@dpb thank you for your answer: can we plot the data like top figure(your figure) have inset too, also if possiple i want plot the data of 2 dimension too with data again, my coding is bad at matlab iam work in maple and this data i take it from maple becuase matlab have a better design for publishing paper
You can add as many axes as you wish following the outline above for the one...you just have to keep track of which is which and make sure are working on the desired one at all times.
The language barrier doesn't help in communicating; perhaps if you were to sketch by hand a rough outline of the figure you envision and attach a picture of it folks could get an idea of the intent and have suggestions on how to achieve it. Unfortunately, while I'd love to help futher, at this point I simply don't have a good enough idea of the end objective to be able to add anything further.
dpb
dpb on 18 Dec 2024
Edited: dpb on 18 Dec 2024
On "change the design", if you mean to modify the characteristics of a 3D surf() or surfc() plot somehow, then the answer is probably "you can't" other than through the various properties made visible; the base 2D and 3D plots are packaged functions that are not amenable to gross changes in their characteristics. You can change colors, lines, scale and range the image, and add annotations, etc., etc., ... but a 3D plot is always going to be the basic 3D plot; one would have to revert back to extremely low-level calls to create a completely different style of 3D plot. MATLAB-generated plots are all always going to be recognizable as having been done in MATLAB, it's just the use of the builtin graphics system is always going to make it so.
You can change the overall size/shape of a given axes by adjusting the 'Position' values to make it tall and skinny, short and fat or just smaller in the basic figure for another interpretation of what "changing the shape" might mean. You can see that in the inset axes that is scaled by translation (T) and rescaling (R) factors in the example code from the original axes position vector.
@dpb i want constract something new that never been published befor but i don't know what is my mistake in the code How i can fixed my graph have problem the noise is not in every where of my graph that is mistake and i don't know how fixed this i asked a lot of experted but they can't
% Parameters
n = 1;
A = 1; % Amplitude
B = 1; % Width parameter of soliton
v = 1; % Velocity of soliton
alpha = 1; % Nonlinearity parameter
beta = 0.1; % Dispersion parameter
gamma = 0.05; % Noise intensity for multiplicative noise
% Grid for xi and time
xi = linspace(-20, 20, 2000); % Spatial range in transformed coordinates
t = linspace(-20, 20, 2000); % Time range
dt = t(2) - t(1); % Time step
% Generate Wiener process (increments) for time
W = cumsum(sqrt(dt) * randn(size(t))); % Wiener process for each time step
W = gamma * W; % Scale Wiener process by gamma
% Define initial soliton profile (deterministic solution)
u_deterministic = abs(((tanh(0.192e3 ./ 0.35e2 .* t' + xi) - 0.1e1) .^ (0.1e1 ./ 0.4e1)) .* exp(i * (-0.3e1 .* xi - 0.8e1 * t' + (3 .* W' ))));
% Ensure u_deterministic has the correct dimensions (time x space)
if size(u_deterministic, 1) ~= length(t) || size(u_deterministic, 2) ~= length(xi)
error('Mismatch in dimensions of u_deterministic. Check calculations.');
end
% Initialize storage for the stochastic solution
u_stochastic = zeros(length(t), length(xi));
% Time evolution
for n = 1:length(t)
% Apply the Wiener noise factor at time step n
noise_factor = 1 + W(n);
% Update solution with multiplicative noise
u_stochastic(n, :) = u_deterministic(n, :) * noise_factor;
end
% Plot the 3D surface of the stochastic Kudryashov soliton
figure;
surfc(xi, t, u_stochastic, 'EdgeColor', 'none');
xlabel('Transformed Space (\xi)');
ylabel('Time (t)');
zlabel('Amplitude (u)');
title('Stochastic Kudryashov Soliton Solution with Multiplicative Noise (Wiener Process)');
colormap jet;
colorbar;
Well, I certainly don't have any insight to whatever the calculation is; certainly the plot will reflect what you've calculated; what might be wrong there only you can determine.
What might be helpful would be to actually look at what you're generating for the noise; it may not be what you think/expect...
% Parameters
n = 1;
A = 1; % Amplitude
B = 1; % Width parameter of soliton
v = 1; % Velocity of soliton
alpha = 1; % Nonlinearity parameter
beta = 0.1; % Dispersion parameter
gamma = 0.05; % Noise intensity for multiplicative noise
% Grid for xi and time
xi = linspace(-20, 20, 2000); % Spatial range in transformed coordinates
t = linspace(-20, 20, 2000); % Time range
dt = t(2) - t(1); % Time step
% Generate Wiener process (increments) for time
W = cumsum(sqrt(dt) * randn(size(t))); % Wiener process for each time step
W = gamma * W; % Scale Wiener process by gamma
% Define initial soliton profile (deterministic solution)
u_deterministic = abs(((tanh(0.192e3 ./ 0.35e2 .* t' + xi) - 0.1e1) .^ (0.1e1 ./ 0.4e1)) .* exp(i * (-0.3e1 .* xi - 0.8e1 * t' + (3 .* W' ))));
% Ensure u_deterministic has the correct dimensions (time x space)
if size(u_deterministic, 1) ~= length(t) || size(u_deterministic, 2) ~= length(xi)
error('Mismatch in dimensions of u_deterministic. Check calculations.');
end
% Initialize storage for the stochastic solution
u_stochastic = zeros(length(t), length(xi));
noise=zeros(size(u_stochastic));
% Time evolution
for n = 1:length(t)
% Apply the Wiener noise factor at time step n
noise_factor = 1 + W(n);
noise(n,:)=noise_factor;
% Update solution with multiplicative noise
u_stochastic(n, :) = u_deterministic(n, :) * noise_factor;
end
% Plot the 3D surface of the stochastic Kudryashov soliton
figure;
surfc(xi, t, u_deterministic, 'EdgeColor', 'none');
title('Deterministic (Wiener Process)');
xlabel('Transformed Space (\xi)');
ylabel('Time (t)');
zlabel('Amplitude (u)');
colormap jet;
figure
surfc(xi, t, noise, 'EdgeColor', 'none');
title('Multiplicative Noise (Wiener Process)');
xlabel('Transformed Space (\xi)');
ylabel('Time (t)');
zlabel('Amplitude (u)');
colormap jet;
figure
surfc(xi, t, u_stochastic, 'EdgeColor', 'none');
title('Stochastic (Wiener Process)');
xlabel('Transformed Space (\xi)');
ylabel('Time (t)');
zlabel('Amplitude (u)');
colormap jet;
That shows you the pieces that you have calculated and the net result; what resemblance they have to expected I've no way to know... :)
But, the end result looks pretty much like one would expect from the two pieces; all the noise prior to the t==0 origin goes away because it's being multiplied by zero from the looks of it; the rest looks like the deterministic with some wiggles thrown in...the initial rise is so sharp it looks pretty smooth; expanding the time axis around the origin would possibly be illuminative before the upper plateau dominates.
figure
surfc(xi, t, u_stochastic, 'EdgeColor', 'none');
title('Stochastic (Wiener Process)');
xlabel('Transformed Space (\xi)');
ylabel('Time (t)');
zlabel('Amplitude (u)');
colormap jet;
xlim([0 20])
ylim([-5 1])
salim
salim on 20 Dec 2024
Edited: salim on 20 Dec 2024
@dpb Thank you so much for your effort and for dedicating your valuable time to this problem. If I may, I’d like to provide a bit more explanation about the issue, as I’m new to stochastic processes. This is my first encounter with a problem involving a Wiener process in the context of solving a soliton solution, and I’m not sure how to approach it correctly. I solved the problem using a different method, but I would appreciate any guidance or suggestions.
Below is my solution. As you can see, the Wiener process appears in the PDE soliton solution. I’ve treated all variables as constants except for delta and w(t), where w(t) represents a random Wiener process. The key parameter is delta. When δ=0, there is no noise in the system, but as delta increases, the noise becomes more pronounced. My goal is to demonstrate how changes in delta affect the behavior of the function.
and this is solution of paper
alos countour of graph must be like this which show all part of noise
Additionally, this is another paper that demonstrates the effect of delta and includes a 3D graph showing the same behavior that you referenced. That’s the entire concept I wanted to convey.
In the top picture, ϵ corresponds to δ in our function. As ϵ (or delta) increases, the noise also increases. I want to highlight this effect. If you have any questions, I’ll be here to answer them. Thank you for your valuable work!
i want something very clear like the picture full detailed
Those have been rotated and limits applied so that the axis of the minimum is approximately straight on in view for the two to the left; the RH one for some reason was left rotated somewhat less, but sill some. Yours, however, are all still at the default viewpoint; you can either programmatically locate the minimum of the trough with time, t, in order to know that angle. Or, probably simpler would be to just use the edit tool to rotate the image until you can find the orientation from which to view it that looks as you want and then use that set of camera positions programmatically as starting point.
However, the annotation on the lower traces certainly is confusing; it says they're for a given epsilon and x=0.1 -- but if x were to be held constant in the upper 3D view, the resulting trace with time would be a constant. Those traces are, by the labelling of the axes in the 3D plots, at a specific time versus x, not at a fixed x against time.
Good luck...

Sign in to comment.

Categories

Find more on Graphics in Help Center and File Exchange

Products

Release

R2021b

Asked:

on 17 Dec 2024

Commented:

dpb
on 20 Dec 2024

Community Treasure Hunt

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

Start Hunting!