Need some help with matlab?
-
Hi, How would I go about writing a function in matlab that outputs an array of amplitudes for given times to produce a combined sine wave, when given arrays of freq, amp, phase and time. I have written some code that outputs the correct result: Fs = 8192; n=input('Enter the number of simple waves you would like to use: '); time = linspace(0,1,8192); for i=1:n freq = input(['Enter frequency ' num2str(i) ': ']); amp = input(['Enter amplitude ' num2str(i) ': ']); phase = input(['Enter phase ' num2str(i) ': ']); x(i,:) = amp .* sin(2 .* pi .* freq .* time + phase); t = sum(x); however i need to convert this into a function? Any ideas would be appreciated. Thanks in advance
-
Answer:
A function is an m-file. It's defined in the first line of the code: function [out1, out2, ...] = your_function(in1, in2, ...) out1, out2... are the output variables in1, in2... are the input variables. I suggest you visit the site below. It gives you several detailed examples... .
jjasso5 at Yahoo! Answers Visit the source
Other answers
A function is an m-file. It's defined in the first line of the code: function [out1, out2, ...] = your_function(in1, in2, ...) out1, out2... are the output variables in1, in2... are the input variables. I suggest you visit the site below. It gives you several detailed examples... .
jjasso5
Related Q & A:
- I need desperate help.Best solution by Yahoo! Answers
- I need Ebay help.Best solution by Yahoo! Answers
- I need some help about yahoo answers.Best solution by Yahoo! Answers
- Need some help about Suzuki bike?Best solution by Yahoo! Answers
- Msn messenger help need some help?
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.