How to write an optimization algorithm?? any type of optimization algorithm?? can anyone tell me with the help of a matlab program?

1 vue (au cours des 30 derniers jours)
%I have 2 variables. n=[7:.0001:9];
d = linspace(1, 100, length(n));
%i have to put them in these formulas
[a]=d.*n;
[p]= (2*pi*[a]*cos(45))/300;
[A]=cos(p);
[B]=(1i.*sin(p)/n);
[C]=1i.*n.*sin(p);
[D]=cos(p);
%Reflection coefficient
x=3;
z=5;
[r]=real((n(1).*[A]+x.*z.*[B]+[C]-z.*[D])./(x.*[A]+x.*z.*[B]+[C]+z.*[D]));
%REFLECTIVITY.
R=([r].^2)*100;
%to get the R=30. and show what variables of n and d gets R=30.
%This i have to do using optimization. Can any1 do it??
  1 commentaire
John D'Errico
John D'Errico le 22 Fév 2015
Modifié(e) : John D'Errico le 22 Fév 2015
Please don't start asking the same question over and over again. I did not answer this question, and I won't answer the exact replicate question you posed. Why not?
If you want to learn how to use an optimization tool, then look at the tutorials for the optimization toolbox. Or read the help/docs for fminsearch.
If you want to learn how to write an optimization code, then this is the wrong place. There are entire books written on the subject. And for me (or anyone else) to try to tell someone who is apparently a complete novice to this area of mathematics is the beginning of an impossible task, as it would become simply be too long of a discussion.
So take a course, or read a book. There are an immense number of books on optimization to be read. Or use one of the MANY pieces of software already written for the purpose.

Connectez-vous pour commenter.

Réponse acceptée

Erik S.
Erik S. le 22 Fév 2015
Ok, I send the file again.... but I think there is an error in your function. It is not 30 anywhere... If you find my help usefull pls vote on my answer or accept my answer.

Plus de réponses (2)

Erik S.
Erik S. le 18 Fév 2015
I started with a code to help you. But I don't know how you mean with n(3), If you want to find a single value for n, you cannot use it like a vector. Another question to you is when you write cos(45), is it in degrees? cos uses radians, you can use the function cosd(45) instead
  2 commentaires
Erik S.
Erik S. le 19 Fév 2015
Hi
I got your e-mail but I dont understand the values n(i) and n(s). Can you give me constant values for them?

Connectez-vous pour commenter.


Erik S.
Erik S. le 23 Fév 2015
Hi, I forgot to attach, here it is..

Catégories

En savoir plus sur Get Started with Optimization Toolbox dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by