Prev: rtwmakecfg and S function written in M file
Next: help! LLR calculation for LDPC iterative decoding on Rayleigh flat fading channel?
From: Gareth Jones on 17 Nov 2009 06:30 Hello, I'm trying to change my Y axis to a log10 one, but nothing is happening when I enter the code that I thought would solve the problem! I've got the two lines which I thought would do what is intended: semilogy(Y); scatter(X,Y); I get the following message: 'Undefined function or method 'semilog' for input arguments of type 'double' I know this is probably because my 'Y' contains numbers such as 1.234 rather than whole numbers. Is there any way to create log10 using doubles?
From: Wayne King on 17 Nov 2009 06:53 "Gareth Jones" <gmj123(a)hotmail.co.uk> wrote in message <hdu1gf$5uh$1(a)fred.mathworks.com>... > Hello, > > I'm trying to change my Y axis to a log10 one, but nothing is happening when I enter the code that I thought would solve the problem! > > I've got the two lines which I thought would do what is intended: > > semilogy(Y); > scatter(X,Y); > > I get the following message: > > 'Undefined function or method 'semilog' for input arguments of type 'double' > > I know this is probably because my 'Y' contains numbers such as 1.234 rather than whole numbers. > > Is there any way to create log10 using doubles? Gareth, are you sure that you don't have a typo in your code? you've typed semilogy(Y) above, but the error message you've given indicates that you have a typo in your code and you're trying to call an unknown function semilog(). Check your code carefully to see if you've made a typo. Wayne
From: Gareth Jones on 17 Nov 2009 08:15 "Wayne King" <wmkingty(a)gmail.com> wrote in message <hdu2qu$717$1(a)fred.mathworks.com>... > "Gareth Jones" <gmj123(a)hotmail.co.uk> wrote in message <hdu1gf$5uh$1(a)fred.mathworks.com>... > > Hello, > > > > I'm trying to change my Y axis to a log10 one, but nothing is happening when I enter the code that I thought would solve the problem! > > > > I've got the two lines which I thought would do what is intended: > > > > semilogy(Y); > > scatter(X,Y); > > > > I get the following message: > > > > 'Undefined function or method 'semilog' for input arguments of type 'double' > > > > I know this is probably because my 'Y' contains numbers such as 1.234 rather than whole numbers. > > > > Is there any way to create log10 using doubles? > > Gareth, are you sure that you don't have a typo in your code? > you've typed semilogy(Y) above, but the error message you've given indicates that you have a typo in your code and you're trying to call an unknown function semilog(). Check your code carefully to see if you've made a typo. > Wayne Hi Wayne, Here is my code, I don't believe anything is wrong, it worked fine in Matlab, although now nothing is appearing in my graph: graph3 = []; for n=3:1:totalfilenum graph3 = [graph3 xlsread('H:\Disc Scratch Test Results - Unamended\', files (n,1).name),'C42:C61')]; end numofcol = size(graph3); totalcol = size((graph3),2); totalrows = size((graph3),1); for t=1:totalcol filenumbers(:,t)=[41:60]; end X = filenumbers(:); %contains whole numbers Y = graph3(:); %contains doubles e.g. 1.432 semilogy(y); scatter(X,Y);
From: Wayne King on 17 Nov 2009 08:50 "Gareth Jones" <gmj123(a)hotmail.co.uk> wrote in message <hdu7kr$et2$1(a)fred.mathworks.com>... > "Wayne King" <wmkingty(a)gmail.com> wrote in message <hdu2qu$717$1(a)fred.mathworks.com>... > > "Gareth Jones" <gmj123(a)hotmail.co.uk> wrote in message <hdu1gf$5uh$1(a)fred.mathworks.com>... > > > Hello, > > > > > > I'm trying to change my Y axis to a log10 one, but nothing is happening when I enter the code that I thought would solve the problem! > > > > > > I've got the two lines which I thought would do what is intended: > > > > > > semilogy(Y); > > > scatter(X,Y); > > > > > > I get the following message: > > > > > > 'Undefined function or method 'semilog' for input arguments of type 'double' > > > > > > I know this is probably because my 'Y' contains numbers such as 1.234 rather than whole numbers. > > > > > > Is there any way to create log10 using doubles? > > > > Gareth, are you sure that you don't have a typo in your code? > > you've typed semilogy(Y) above, but the error message you've given indicates that you have a typo in your code and you're trying to call an unknown function semilog(). Check your code carefully to see if you've made a typo. > > Wayne > > Hi Wayne, > > Here is my code, I don't believe anything is wrong, it worked fine in Matlab, although now nothing is appearing in my graph: > > graph3 = []; > > for n=3:1:totalfilenum > graph3 = [graph3 xlsread('H:\Disc Scratch Test Results - Unamended\', files (n,1).name),'C42:C61')]; > end > > numofcol = size(graph3); > totalcol = size((graph3),2); > totalrows = size((graph3),1); > > for t=1:totalcol > filenumbers(:,t)=[41:60]; > end > > X = filenumbers(:); %contains whole numbers > Y = graph3(:); %contains doubles e.g. 1.432 > > semilogy(y); > scatter(X,Y); Hi Gareth, Without looking at your code in any more depth, I don't see where y is being assigned in what you've posted. Matlab is case sensitive, so you should be getting an error when you try to call semilogy(y) because it is not assigned anywhere in your code. semilogy() should not have any problem with doubles. It will ignore negative numbers though, but that will throw a warning to the workspace. Wayne
From: Claire Mulcock on 17 Nov 2009 14:45
On Nov 18, 2:15 am, "Gareth Jones" <gmj...(a)hotmail.co.uk> wrote: > "Wayne King" <wmkin...(a)gmail.com> wrote in message <hdu2qu$71...(a)fred.mathworks.com>... > > "Gareth Jones" <gmj...(a)hotmail.co.uk> wrote in message <hdu1gf$5u...(a)fred.mathworks.com>... > > > Hello, > > > > I'm trying to change my Y axis to a log10 one, but nothing is happening when I enter the code that I thought would solve the problem! > > > > I've got the two lines which I thought would do what is intended: > > > > semilogy(Y); > > > scatter(X,Y); > > > > I get the following message: > > > > 'Undefined function or method 'semilog' for input arguments of type 'double' > > > > I know this is probably because my 'Y' contains numbers such as 1.234 rather than whole numbers. > > > > Is there any way to create log10 using doubles? > > > Gareth, are you sure that you don't have a typo in your code? > > you've typed semilogy(Y) above, but the error message you've given indicates that you have a typo in your code and you're trying to call an unknown function semilog(). Check your code carefully to see if you've made a typo. > > Wayne > > Hi Wayne, > > Here is my code, I don't believe anything is wrong, it worked fine in Matlab, although now nothing is appearing in my graph: > > graph3 = []; > > for n=3:1:totalfilenum > graph3 = [graph3 xlsread('H:\Disc Scratch Test Results - Unamended\', files (n,1).name),'C42:C61')]; > end > > numofcol = size(graph3); > totalcol = size((graph3),2); > totalrows = size((graph3),1); > > for t=1:totalcol > filenumbers(:,t)=[41:60]; > end > > X = filenumbers(:); %contains whole numbers > Y = graph3(:); %contains doubles e.g. 1.432 > > semilogy(y); > scatter(X,Y); I think you misunderstand what semilogy does. You want to define the y axis as log10, but semilogy tries to PLOT y. Here's what you need to do: scatter(X,Y) set(gca,... 'YScale','log') This is telling Matlab to plot the X,Y points in a scatter plot, then to take the current axes (gca) and set the y axis to log10. It's called handle graphics and you can find out more about it using help. |