MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

### Discover what MATLAB® can do for your career.

 Subject: plot3 From: matlab Date: 24 Sep, 2013 23:26:07 Message: 1 of 5 I have a result R which value depends of 3 variables a, b and c. R=[70 65 89 45 94] a=[0 0.25 0.5 0.75 1] b=[0 0.25 0.5 0.75 1] c=[0 0.25 0.5 0.75 1] R=89 for a=0.5 b=0.5 and c= 0.5 I want to plot the change in R with regards to these 3 variables. How can i do it? From the help of plot3, i couldn't understand how to do it. it states that i have to put plot3(x,y,z) so in my case that would be plot3(a,b,c) but that would consider that the value of R is equal to 1 . Thanks for your time
 Subject: plot3 From: matlab Date: 25 Sep, 2013 00:03:07 Message: 2 of 5 "matlab " wrote in message ... > I have a result R which value depends of 3 variables a, b and c. > R=[70 65 89 45 94] > a=[0 0.25 0.5 0.75 1] > b=[0 0.25 0.5 0.75 1] > c=[0 0.25 0.5 0.75 1] > > R=89 for a=0.5 b=0.5 and c= 0.5 > > I want to plot the change in R with regards to these 3 variables. > How can i do it? > From the help of plot3, i couldn't understand how to do it. > it states that i have to put plot3(x,y,z) so in my case that would be plot3(a,b,c) but that would consider that the value of R is equal to 1 . > > Thanks for your time I saw that scatter3 can change the color the represent the 4th variable(R in my case), however i want to see the value of R in the figure so the color change won't be enough
 Subject: plot3 From: Steven_Lord Date: 25 Sep, 2013 14:19:28 Message: 3 of 5 "matlab " wrote in message news:l1t97r$f90$1@newscl01ah.mathworks.com... > "matlab " wrote in message > ... >> I have a result R which value depends of 3 variables a, b and c. >> R=[70 65 89 45 94] >> a=[0 0.25 0.5 0.75 1] >> b=[0 0.25 0.5 0.75 1] >> c=[0 0.25 0.5 0.75 1] >> >> R=89 for a=0.5 b=0.5 and c= 0.5 >> >> I want to plot the change in R with regards to these 3 variables. How can >> i do it? >> From the help of plot3, i couldn't understand how to do it. >> it states that i have to put plot3(x,y,z) so in my case that would be >> plot3(a,b,c) but that would consider that the value of R is equal to 1 . >> >> Thanks for your time > > I saw that scatter3 can change the color the represent the 4th variable(R > in my case), however i want to see the value of R in the figure so the > color change won't be enough First, get a 4-D monitor. Once you've done that, come back and ask again. The best I think you're going to be able to do is to use SCATTER3 with R representing the color and/or marker size. Perhaps using a LEGEND or a COLORBAR will count as letting you "see the value of R in the figure"? -- Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com
 Subject: plot3 From: matlab Date: 25 Sep, 2013 19:24:08 Message: 4 of 5 "Steven_Lord" wrote in message ... > > > "matlab " wrote in message > news:l1t97r$f90$1@newscl01ah.mathworks.com... > > "matlab " wrote in message > > ... > >> I have a result R which value depends of 3 variables a, b and c. > >> R=[70 65 89 45 94] > >> a=[0 0.25 0.5 0.75 1] > >> b=[0 0.25 0.5 0.75 1] > >> c=[0 0.25 0.5 0.75 1] > >> > >> R=89 for a=0.5 b=0.5 and c= 0.5 > >> > >> I want to plot the change in R with regards to these 3 variables. How can > >> i do it? > >> From the help of plot3, i couldn't understand how to do it. > >> it states that i have to put plot3(x,y,z) so in my case that would be > >> plot3(a,b,c) but that would consider that the value of R is equal to 1 . > >> > >> Thanks for your time > > > > I saw that scatter3 can change the color the represent the 4th variable(R > > in my case), however i want to see the value of R in the figure so the > > color change won't be enough > > First, get a 4-D monitor. Once you've done that, come back and ask again. > > The best I think you're going to be able to do is to use SCATTER3 with R > representing the color and/or marker size. Perhaps using a LEGEND or a > COLORBAR will count as letting you "see the value of R in the figure"? > > -- > Steve Lord > slord@mathworks.com > To contact Technical Support use the Contact Us link on > http://www.mathworks.com I decided to try with bar3 and concatenata the 3 dimensions in one (since i have to compare 3 results R1, R2 and R3), my code looks like that R=[74 81 87.5; 69 74 77; 98 67 68; 91 77 78;] figure h = bar3(R); colorbar for k = 1:length(h)     zdata = get(h(k),'ZData');     set(h(k),'CData',zdata,...              'FaceColor','interp') end set(gca,'XTickLabel',{'R1' ,'R2', 'R3' }) % Add title and axis labels xlabel('{Solutions}'); ylabel('Parameters'); zlabel('Results'); str={'\alpha=1,\beta=0,\gama=0', 'a=0,b=1,c=0', 'a=0,b=0,c=1', 'a=1,b=0.5,c=0'} set(gca,'YTickLabel',str,'fontname','symbol') I have 2 problems with this, First the colorbar values don't match the values in the Z axis (although i exactly followed an example where it worked just fine before) http://www.mathworks.com/help/matlab/creating_plots/color-3-d-bars-by-height.html Second, i want to have the greek symbols in the YTickLabel only but i am having also the text in the 'XTickLabel becoming greek too, i even tried setting the font back to helvicta after the YTickLabe but then lost the greek symbols
 Subject: plot3 From: matlab Date: 25 Sep, 2013 23:44:07 Message: 5 of 5 "matlab " wrote in message ... > "Steven_Lord" wrote in message ... > > > > > > "matlab " wrote in message > > news:l1t97r$f90$1@newscl01ah.mathworks.com... > > > "matlab " wrote in message > > > ... > > >> I have a result R which value depends of 3 variables a, b and c. > > >> R=[70 65 89 45 94] > > >> a=[0 0.25 0.5 0.75 1] > > >> b=[0 0.25 0.5 0.75 1] > > >> c=[0 0.25 0.5 0.75 1] > > >> > > >> R=89 for a=0.5 b=0.5 and c= 0.5 > > >> > > >> I want to plot the change in R with regards to these 3 variables. How can > > >> i do it? > > >> From the help of plot3, i couldn't understand how to do it. > > >> it states that i have to put plot3(x,y,z) so in my case that would be > > >> plot3(a,b,c) but that would consider that the value of R is equal to 1 . > > >> > > >> Thanks for your time > > > > > > I saw that scatter3 can change the color the represent the 4th variable(R > > > in my case), however i want to see the value of R in the figure so the > > > color change won't be enough > > > > First, get a 4-D monitor. Once you've done that, come back and ask again. > > > > The best I think you're going to be able to do is to use SCATTER3 with R > > representing the color and/or marker size. Perhaps using a LEGEND or a > > COLORBAR will count as letting you "see the value of R in the figure"? > > > > -- > > Steve Lord > > slord@mathworks.com > > To contact Technical Support use the Contact Us link on > > http://www.mathworks.com > > I decided to try with bar3 and concatenata the 3 dimensions in one (since i have to compare 3 results R1, R2 and R3), my code looks like that > > R=[74 81 87.5; > 69 74 77; > 98 67 68; > 91 77 78;] > > figure > h = bar3(R); > colorbar > for k = 1:length(h) > zdata = get(h(k),'ZData'); > set(h(k),'CData',zdata,... > 'FaceColor','interp') > end > > set(gca,'XTickLabel',{'R1' ,'R2', 'R3' }) > % Add title and axis labels > xlabel('{Solutions}'); > ylabel('Parameters'); > zlabel('Results'); > > str={'\alpha=1,\beta=0,\gama=0', 'a=0,b=1,c=0', 'a=0,b=0,c=1', 'a=1,b=0.5,c=0'} > set(gca,'YTickLabel',str,'fontname','symbol') > > I have 2 problems with this, > First the colorbar values don't match the values in the Z axis (although i exactly followed an example where it worked just fine before) > http://www.mathworks.com/help/matlab/creating_plots/color-3-d-bars-by-height.html > > Second, i want to have the greek symbols in the YTickLabel only but i am having also the text in the 'XTickLabel becoming greek too, > i even tried setting the font back to helvicta after the YTickLabe but then lost the greek symbols i deplaced colormap after the for loop and the first problem is solved. i am still stuck with the alpha, beta and gama symbols though.