How to give gap between curves? Please see the attached graph

1 Ansicht (letzte 30 Tage)
Hi,
I have generated the graph in which there are a lot of curves generated, but I do not want to plot all of the curves -- there are 86 curves on that graph. I want to specify few curves only. I am not sure how to do it. Can anyone help?
Code:
w = [0,1,2,3,4,5,23,230,324,2130,2130,123,123,0.3242000,0.2320000,0.2232400000,0.271950151680000,0.307006225920000,0.344186910720000,0.383492206080000,0.424922112000000,0.468476628480000,0.514155755520000,0.561959493120000,0.611887841280000,0.663940800000000,0.718118369280000,0.774420549120000,0.832847339520000,0.893398740480000,0.956074752000000,1.02087537408000,1.08780060672000,1.15685044992000,1.22802490368000,1.30132396800000,1.37674764288000,1.45429592832000,1.53396882432000,1.61576633088000,1.231,1.78573517568000,1.87390651392000,1.96420246272000,2.05662302208000,2.15116819200000,2.24783797248000,2.34663236352000,2.44755136512000,2.55059497728000,2.65576320000000,2.76305603328000,2.87247347712000,2.98401553152000,3.09768219648000,3.21347347200000,3.33138935808000,3.45142985472000,3.57359496192000,3.69788467968000,3.82429900800000,3.95283794688000,4.08350149632000,4.21628965632000,4.35120242688000,4.48823980800000,4.62740179968000,4.76868840192000,4.91209961472000,5.05763543808000,5.20529587200000,5.35508091648000,5.50699057152000,5.66102483712000,5.81718371328000,5.97546720000000].'
%w = 0.00106230528000000
x = [0:0.008:3.4];
L = 3.4
E = 2.1E11
I = ((0.115465)^4)/12;
y = (((w.*x).*(L-x))/(24*E*I*L)).*(L^2+(x.*(L-x)))
plot (x,y,'Color',[0.4940, 0.1840, 0.5560],'LineStyle','-','LineWidth',1.5)
The x and w values cannot be changed. I want some sort of line saying that as plotting 1 to 86 graph.... plot 1,10,15 so on until curves on the graph

Akzeptierte Antwort

Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam am 16 Okt. 2020
Do you want something like this?
plot (x,y,'Color',[0.4940, 0.1840, 0.5560],'LineStyle','-','LineWidth',1.5)
hold on
plot (x,1.86 * y,'b','LineStyle','-','LineWidth',1.0);
plot (x,1.10 * y,'b','LineStyle','-','LineWidth',1.0);
  4 Kommentare
muhammad choudhry
muhammad choudhry am 16 Okt. 2020
Bearbeitet: muhammad choudhry am 16 Okt. 2020
haha, Please see the attached script. yep, I am calculating deflection on the beam. So, basically what I am doing keeping the load same (UDL) through out the length and I have around 87 load values here, so I want to tell the code I want to plot the curves at after every 10 curves lets say start from 0, 10th(whateverload it is), 20th,30,40,50, until 87th is the last one. ratther than it plotting all of them curves.
Just looking for a sort of code line where I can specify few curves and plot only them curves
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam am 16 Okt. 2020
You can limit the curves by this way
close all
clear all
clc
w = [0,0.00106230528000000,0.00424922112000000,0.00956074752000000,0.0169968844800000,0.0265576320000000,0.0382429900800000,0.0520529587200000,0.0679875379200000,0.0860467276800000,0.106230528000000,0.128538938880000,0.152971960320000,0.179529592320000,0.208211834880000,0.239018688000000,0.271950151680000,0.307006225920000,0.344186910720000,0.383492206080000,0.424922112000000,0.468476628480000,0.514155755520000,0.561959493120000,0.611887841280000,0.663940800000000,0.718118369280000,0.774420549120000,0.832847339520000,0.893398740480000,0.956074752000000,1.02087537408000,1.08780060672000,1.15685044992000,1.22802490368000,1.30132396800000,1.37674764288000,1.45429592832000,1.53396882432000,1.61576633088000,1.69968844800000,1.78573517568000,1.87390651392000,1.96420246272000,2.05662302208000,2.15116819200000,2.24783797248000,2.34663236352000,2.44755136512000,2.55059497728000,2.65576320000000,2.76305603328000,2.87247347712000,2.98401553152000,3.09768219648000,3.21347347200000,3.33138935808000,3.45142985472000,3.57359496192000,3.69788467968000,3.82429900800000,3.95283794688000,4.08350149632000,4.21628965632000,4.35120242688000,4.48823980800000,4.62740179968000,4.76868840192000,4.91209961472000,5.05763543808000,5.20529587200000,5.35508091648000,5.50699057152000,5.66102483712000,5.81718371328000,5.97546720000000].';
%w = 0.00106230528000000
x = [0:0.008:3.4];
L = 3.4;
E = 2.1E11;
I = ((0.008)^4)/12;
y = (((w.*x).*(L-x))/(24*E*I*L)).*(L^2+(x.*(L-x)));
% y(10:10:end, :)
% or some y's like this:
% plot(x, y([1, 5, 10, 40, 50, 55],:))
% that plots only some curves
plot (x,y(10:10:end,:),'Color',[0.4940, 0.1840, 0.5560],'LineStyle','-','LineWidth',1.5);
hold on

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Image Analyst
Image Analyst am 16 Okt. 2020
Try setting up a vector that lists whatever rows you want to plot:
w = [0,1,2,3,4,5,23,230,324,2130,2130,123,123,0.3242000,0.2320000,0.2232400000,0.271950151680000,0.307006225920000,0.344186910720000,0.383492206080000,0.424922112000000,0.468476628480000,0.514155755520000,0.561959493120000,0.611887841280000,0.663940800000000,0.718118369280000,0.774420549120000,0.832847339520000,0.893398740480000,0.956074752000000,1.02087537408000,1.08780060672000,1.15685044992000,1.22802490368000,1.30132396800000,1.37674764288000,1.45429592832000,1.53396882432000,1.61576633088000,1.231,1.78573517568000,1.87390651392000,1.96420246272000,2.05662302208000,2.15116819200000,2.24783797248000,2.34663236352000,2.44755136512000,2.55059497728000,2.65576320000000,2.76305603328000,2.87247347712000,2.98401553152000,3.09768219648000,3.21347347200000,3.33138935808000,3.45142985472000,3.57359496192000,3.69788467968000,3.82429900800000,3.95283794688000,4.08350149632000,4.21628965632000,4.35120242688000,4.48823980800000,4.62740179968000,4.76868840192000,4.91209961472000,5.05763543808000,5.20529587200000,5.35508091648000,5.50699057152000,5.66102483712000,5.81718371328000,5.97546720000000].';
%w = 0.00106230528000000
x = [0:0.008:3.4];
L = 3.4;
E = 2.1E11;
I = ((0.115465)^4)/12;
y = (((w.*x).*(L-x))/(24*E*I*L)).*(L^2+(x.*(L-x)));
numCurves = size(y, 1)
x = repmat(x, [numCurves, 1]);
% Plot every 10th row starting from row 7:
rowsToPlot = 7 : 10 : size(y, 1);
plot (x(rowsToPlot, :)', y(rowsToPlot, :)', 'Color',[0.4940, 0.1840, 0.5560], 'LineStyle','-', 'LineWidth',1.5)
grid on;
xlabel('x', 'FontSize', 15);
ylabel('w', 'FontSize', 15);

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by