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 really never thought that I would get Kiwi essay writing experts online. I just searched randomly and landed on their page. There was a phone number available and I thought why not? Then I chatted with the expert and I got to know that she was also from the same university as I am in. It was kind of cool as she knew my syllabus and helped me out by writing and excellent essays which helped me get great grades.
Designing a motivational strategy as a part of the employee development plan was a tough ask for me as I missed few classes last semester. However, the help I got from HwA was remarkable and they not only offered me the assignment solution but also at the same time helped me to understand the concepts.
The one on one personalized electrical engineering online tutoring sessions at TheReliableTutor has really helped me better understand the underlying concepts of Circuit analysis, circuit diagrams, Parallel DC circuits, and many more. Thanks to the patience and personalized attention of the online electrical engineering tutor I have been able to effectively improve my grades.
During my final year at my nursing school I was given an assignment on the steps to deal with the issue of ineffective airway clearance of post thyroidectomy patients. Obviously, I did not have much idea but when I approached the endocrine assignment expert here at HwA she guided me with the nursing interventions along with medical rationales which again helped me to gain good grades.
The prices for the assignment help at HwA are very reasonable and the quality of electric field assignment writing that I received was of a very high quality. There is never any compromise in the quality of work by the electric field assignment experts and they are extremely professional in their approach to any kind of electric field assignment questions.
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.