GOAL: I have two independent arrays y1 and y2 and want to plot them depending on x1 and x2 in the same graph. The curves should be plotted as symbols and not as lines. I wrote the following lines:
X1=[1:99,1]'; X2=[1:199,1]; Y1=rand(100,1); Y2=rand(200,1)*-1; h=plot(X1,Y1,X2,Y2); axis([0 200 -1 1]) %Curve Properties set(h,{'Color'},{'r';'g'}) set(h,{'LineStyle'},{'s';'v'}) set(h,{'MarkerSize'},{4;4})
PROBLEM: Unfortunately, the curves are not plotted as symbols and the colors are not accepted also. I obtain the following error:
Error using set Value cell array handle dimension must match handle vector length
I read the instructions to use "set" but did not understand how to correct the command lines. I wonder if someone could help me to fix this.
X1 = [1:99,1]'; X2 = [1:199,1]; Y1 = rand(100,1); Y2 = rand(200,1)*-1; plot(X1,Y1,'rs','markersize',4); hold on; plot(X2,Y2,'gv','markersize',4) axis([0 200 -1 1])
Another way:
X1 =[1:99,1]'; X2 =[1:199,1]; Y1 = rand(100,1); Y2 = rand(200,1)*-1; h = plot(X1,Y1,X2,Y2); axis([0 200 -1 1]) set(h(1),'color','r','linestyle','s','markersize',4); set(h(2),'color','g','linestyle','v','markersize',4);
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.