MATLAB

Hi, I need to display an image that's stored in an array. I do the following:

[X,Y]=meshgrid(1:1:10,1:1:10);
f=0.5*(1+0.9*sin(0.2*pi.*X)+0.1*cos(pi.*Y));

and I want to view the image with a title so I was told I can use  the 'show' function like:
show (f*64,'TITLE');
but when I do that, I get an error : "??? Undefined function or variable 'show'."
Why is that happening ?

I can view the image by using imshow(f); but then i cann't add a title.

BTW, I'm using MATAB ver. 5.3.


Arnon David.
LVL 3
arnondAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arnondAuthor Commented:
Edited text of question.
0
ggilmanCommented:
I don't remember ever seeing a 'show' function in Matlab. Looking at your plot I like mesh(f) or surf(f) better myself. To do a title, use the title command "title('title')". There are other optional parameters for this too if needed. Matlab has online help. Goto help->Help window. For graphs look under  matlab\graph2d or matlab\graph3d. Help on title is under the graph2d. Tested title function on your imshow and it worked.
0
ggilmanCommented:
Try it like this. Looks pretty good. I decreased the step size to show a cleaner curve & used surf instead.

>>[X,Y]=meshgrid(1:.25:10,1:.25:10);
>>f=0.5*(1+0.9*sin(0.2*pi.*X)+0.1*cos(pi.*Y));
>>surf(f)
>>title('My surface plot')
0
Redefining Cyber Security w/ AI & Machine Learning

The implications of AI and machine learning in cyber security are massive and constantly growing, creating both efficiencies and new challenges across the board. Join our webinar on Sept. 21st to learn more about leveraging AI and machine learning to protect your business.

arnondAuthor Commented:
ggilman, It's supposed to be an image and not a plot (that's why I used imshow(). It's for an image processing course. The TA handed out an exaple and it uses show().

Arnon David.
0
ggilmanCommented:
I looked at the Matlab help and they don't have a "show" routine. Could this be a function that the TA wrote and is just calling it from the code? My guess is that he wrote a function that takes the input of a matrix and title and within the routine plots the image and then plots the title.
There is imshow() like you mentioned and you can still use title like I said. I was giving you the way that I thought was best but if you need it as an image, that's fine too. Matlab uses the same title function (as well as many other common functions) for all types of figures. I get a title using the following code. Also just for academic sake, you might look at image() and imagesc(). They make images too.

>> [X,Y]=meshgrid(1:1:10,1:1:10);
>> f=0.5*(1+0.9*sin(0.2*pi.*X)+0.1*cos(pi.*Y));
>> imshow(f)
>> title('mytitle')
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ggilmanCommented:
BTW, image() and imagesc() may be part of the image processing toolbox. If you don't have it installed, they probably won't work.
0
ggilmanCommented:
On second thought, is that why show() doesn't work? Rather than being a user-written function, you may need a specific toolbox installed. If this is the case, whatever toolbox it is I don't have it either and imshow() is part of image processing so apparently you have that one. I've looked in help and can't find it in any of the other toolboxes either but I guess it's possible.
0
arnondAuthor Commented:
I don't know if the show function is something special. I'll have a lesson in a few days so I'll ask the TA what he ment.

Arnon.
0
ggilmanCommented:
Well,any news??
0
arnondAuthor Commented:
sorry for being so late. The show() function was indeed written by the TA and now he told me to use imshow() and title() to get the same effect. so I reject  your answer and will accept one of the comments that's better suited.

Arnon.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Hardware

From novice to tech pro — start learning today.