Question

In: Computer Science

Can you show how to do this step by step using Matlab please. Write a function...

Can you show how to do this step by step using Matlab please.

Write a function with header [S] = myAddString(S1, S2), where S is the concatenation of the stings S1 and S2.

Test Cases: S = myAddString(myAddString('Programming', ' '), myAddString(' is ', 'fun! '))

S = Programming is fun!

Solutions

Expert Solution

We are providing the step by step formulation first. Finally we will consolidate the entire script and run for the test case given.


1) Function header

- function [S] = myAddString(S1, S2)
- Here the input is S1,S2
- Output is concatenated S

2) concatenation, we can do this using inbuilt function and generic approach as well. We will follow the generic approach:

Example: if two strings are a='AB' and b='CD', then to concatenate them we will do
c = [a,b]--> this will return the output string 'ABCD' in the c.
Thus for our program, we will do the following:

S = [S1,S2];

3) And that's it, we end the function script with an 'end'
end

The total compiled script is:

%===================================
function [S] = myAddString(S1, S2)
S = [S1,S2];
end
%===================================

Note: The function script must be saved with the filename same as that of the function's name

Please find the run of the program as executed in the MATLAB as the following:

Hope this helps!

***************** PLEASE THUMBS UP!!!!!!!!!!!!!!!!!! *****************


Related Solutions

Can you please show how you would solve the following using excel? Step by Step? Kaelea,...
Can you please show how you would solve the following using excel? Step by Step? Kaelea, Inc., has no debt outstanding and a total market value of $117,000. Earnings before interest and taxes, EBIT, are projected to be $8,300 if economic conditions are normal. If there is strong expansion in the economy, then EBIT will be 23 percent higher. If there is a recession, then EBIT will be 32 percent lower. The company is considering a $41,700 debt issue with...
What is normalzing a wavefunction and how do you do it step by step? Please show...
What is normalzing a wavefunction and how do you do it step by step? Please show TWO different examples (one for SHO question, an IPW question, etc) Thanks!
How can I solve this problem? Can you please show step by step how to solve...
How can I solve this problem? Can you please show step by step how to solve this? Qd = 2,000 − 10P MC = 0.1Q
Please use MATLAB. Write a program to plot the piecewise function using IF statements and a...
Please use MATLAB. Write a program to plot the piecewise function using IF statements and a FOR loop in MatLab. Use x as the input vector. Plot from -20<=x<=20, increment of 1.   y =   4 x + 10 ,             ? ≥ 9,                   y =      5? + 5,                   0 ≤ ? < 9,                    y =     ?2 + 6? + 8, ? < 0 Plot each segment of the fn with different shaped points and a different color, for...
Can someone show me how to write a Haskell function using snd on a list of...
Can someone show me how to write a Haskell function using snd on a list of tuples to create a new list of just the second element in each tuple? Ex. [(‘m’, False), (‘w’, False), (‘n’, True)] would evaluate to [False, False, True].
Could you please show step by step how I can get IRR after computing Present value...
Could you please show step by step how I can get IRR after computing Present value of cash flows and NPV Exercise 11-13A Internal rate of return LO P4 Following is information on two alternative investments being considered by Tiger Co. The company requires a 4% return from its investments. Project X1 Project X2 Initial investment $ (80,000 ) $ (120,000 ) Expected net cash flows in year: 1 25,000 60,000 2 35,500 50,000 3 60,500 40,000
Please do step by step clear and show eqations used. Thank you A rocket designed to...
Please do step by step clear and show eqations used. Thank you A rocket designed to place satellites into orbit is carried to a cruising altitude. When the plane is flying in a straight line and at a constant speed of 850 km/h, the rocket is dropped. After the drop the plane continues to fly at the same pseed and in a straight line. The rocket falls for a bried time, and then its propulsion starts. Once the propulsion starts...
And please show me the step by step process of how you solved the question. I...
And please show me the step by step process of how you solved the question. I have a learning disability and I need to know the steps to solve the question If it takes 17.5 mL of 0.085 M NaOH to titrate a 15 mL sample of sauerkraut juice, what is the acidity of that juice, expressed as % lactic acid (wt/vol)?
How to design FIR lowpass filter using matlab. Note : Do not write matlab code. Only...
How to design FIR lowpass filter using matlab. Note : Do not write matlab code. Only explain the steps of designing filter
How can I solve this in Excel? Please show how to solve it in excel step...
How can I solve this in Excel? Please show how to solve it in excel step by step. 1) Speedy Wheels is a wholesale distributor of bicycles for the western United States. Its Inventory Manager, Ricky Sapolo, is currently reviewing the inventory policy for one popular model — a small, one-speed girl's bicycle that is selling at the rate of 250 per month. The administrative cost for placing an order for this model from the manufacturer is $200 and the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT