Hi,
I am new to Matlab and facing few issues in the following code:
1) I need to plot the graphs with varying the values of G. #1 for G=1.4, Molecular_Weight=28.97 ; #2 G=1., Molecular_Weight=28 ; #3 G=1.4 Molecular_Weight = 1.66 Can you please let me know the simplest way to do it, so I get the results in the same plot.
2) The current spacing between the plots is too less, what can I do to increase the spacings.
Thank you in advance! Your help would mean a lot to me.

 채택된 답변

Jithin Nambiar J
Jithin Nambiar J 2021년 4월 11일

0 개 추천

The line figure you've entered before subplot(3,2,5) is used to open a new figure window.
figure
subplot(3,2,5)
Just comment or remove the line figure to solve your problem.
Cheers!

댓글 수: 7

Saumya Nagar 17BME0447
Saumya Nagar 17BME0447 2021년 4월 11일
Thank you Jithin for helping me out. Can you please let me know how should I get the plot by variying G, and MW. Thanks!
Jithin Nambiar J
Jithin Nambiar J 2021년 4월 11일
편집: Jithin Nambiar J 2021년 4월 11일
Create two arrays/lists. G and MW, assign them as follows
G=[1.4,1,1.4]
MW = [28.97,28,1.66]
Then iterate through the length of one of the arrays
for i=1:numel(G)
disp(G(i))
end
You can use G(i) and MW(i) for accessing the 3 elements of the lists. Replace the G and MW in your code with these.
Finally to have multiple plots in a single plot use
plot(x,y)
subplot(3,2,4)
hold on
This must be done for each plots
And at the end of the iterator which iterates through the values in the array G and MW. Use
hold off
Hope this helps. Cheers
Saumya Nagar 17BME0447
Saumya Nagar 17BME0447 2021년 4월 11일
Hi Jithin,
Yes, that was one of my questions, and it worked well. Now, I have got five subplots in a single window.
On all the five subplots, now I want to see the effect of changing the G and Mol. Weight values (total three cases i.e. #1 for G=1.4, Molecular_Weight=28.97 ; #2 G=1., Molecular_Weight=28 ; #3 G=1.4 Molecular_Weight = 1.66). Can you please let me know how should I do that, so I get the plot for all the three cases in a single window (the same five subplots)? I look forward to your reply. Thanks!
Jithin Nambiar J
Jithin Nambiar J 2021년 4월 11일
편집: Jithin Nambiar J 2021년 4월 11일
I've edited my reply after reading your question. Upvote if anything helps.
I highly recommend completing the MATLAB Onramp course available for free. Have a great day.
Jithin Nambiar J
Jithin Nambiar J 2021년 4월 12일
Hope it helped!
Saumya Nagar 17BME0447
Saumya Nagar 17BME0447 2021년 4월 18일
Thanks a lot

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

제품

태그

Community Treasure Hunt

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

Start Hunting!

Translated by