Get in touch with us
Send us an e-mail
Question
This problem implements a simple calculator using RPN notation. The application will consist of user input, stack operation, and displaying the result. RPN calculations work in conjunction with a stack. Every time a user enters a number, the number should be pushed on the stack. When the user enters a function, the top element or elements of the stack are used in the calculation and the result is placed on the stack.
a) Create a MATLAB class that implements a stack with the following methods: Push, Pop, is Empty, GetContents, and a constructor. The GetContents method is needed to display the elements of the stack.
b) Write a script that will take user inputs as strings and perform the following operations:
i) If the user enters a number, push it on the stack. A function needs to be written to determine if a string is valid number. The function is strprop is a good starting point.
ii) If the user enters a string, treat it like a function and evaluate it using the number on the top of the stack, and push the result on the stack. The only functions allowed are +,-,*,/, sin, cos, tan, and exp. The calculator should also support the following constants: pi and e. Look into the switch statement.
c) Always display the contents of the top 3 elements of the stack prior to asking for input.
Example: 2: 0
1: -1.03
0: 2.2
>Input>>>>
d) Run the code with the following inputs. Show the stack after each step.
i) 2 2 + 3 *
ii) pi 2 / sin
iii) 2 4 + 2 / exp
iv) 2 3 4 + *
Summary
This question belongs to MATLAB software and discusses about application of MATLAB in operations management and to write a script that will take user inputs as strings and perform the given operations.
Download Full Solution
I had no clue about how to write a qualitative research paper on Faulkner and so I approached TheReliableTutor.com. I was also not sure whether they could help me or not but to my surprise they started asking the right kind of questions to me. When I clarified them with my professor, she was impressed and told me that I understood the concept of a research paper. The rest of it was a walk in the park. With my professor’s inputs they provided an excellent research paper and help me get an A
I was confused with an assignment involving need-based and behavior-based employee motivation strategies when I came to pursue help from HwA. The organizational behavior assignment help experts are friendly here and they helped me with the solution and I got excellent grades.
1. When I tell the online accounting assignment help expert what I am looking for from the assignment solution that is exactly what I receive from them. Having the understanding of how the universities and professors work in Singapore is definitely a plus for the online Singapore accounting assignment help experts at HwA.
I was clueless about my post tracheostomy and laryngectomy patient care assignment, when I came across HwA. Never really believed in the beginning that they have a separate unit for respiratory system assignment solutions and the experts here are really helpful.
Things got very difficult during my 3rd semester of my Mechanical Engineering course. After coming to the States I realized that education here is very challenging. Thanks to TheReliableTutor.com, I completed all the fluid mechanics reports with an A+. Now currently they are working on my mid-tern research report and I am happy with the service.
Comments
this is a very good website
I have 50 questions for the same test your page is showing only 28
hi can you please help or guide me to answer my assignments. thanks
hi can anyone help or guide me to my assignments. thanks
This solution is perfect ...thanks
Hello Allison,I love the 2nd image that you did! I also, had never heard of SumoPaint, is something that I will have to exolpre a bit! I understand completely the 52 (or so) youtube videos that you probably watched. Sometimes they have what you want, sometimes they don't! However, it is always satisfying when you are able to produce something that you have taught yourself. Great job!Debra 0 likes
Perfect bank of solution.
great !
thanks for the quick response. the solution looks good. :)
thnx for the answer. it was perfect. just the way i wanted it.
works fine.