Conversion to logical from sym is not possible.

P
Penelope · Nov 18, 2020 · 1.9K views
Question
clc clear syms t u r a b c d x y j v t Output STP RMP p= input('Number of intervals of the signal (Integer value):'); n=0; a=input('Enter signal starting time:'); b=input('Enter signal function end time:'); while n = -ad, y(i) = m*(t(i) + ad); end end function y = ustep(t,ad) % generation of unit step % t: time % ad : advance (positive), delay (negative) % USE y = ustep(t,ad) N = length(t); y = zeros(1,N); for i = 1:N, if t(i)> = -ad, y(i) = 1; end end I get this error Conversion to logical from sym is not possible. Error in ramp (line 10) if t(i)>=-ad;   Error in Expriments (line 20) RMP(t)=ramp(t,j,x); In general, I am trying to get output as u(t)+r(t) (ramp + step function) and I am stuck at this point.
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Aug 26, 2026
    double c=input('Enter piecewise initial value:');

That means the same thing to MATLAB as

 

      double( 'c=input(''Enter piecewise initial value:'')') ;
which takes a character vector and outputs the vector of character codes corresponding to each character and then throws them away because of the semi-colon. This is an example of "command/function duality"
Because of this you are not assigning to c in that line so c retains its sym declaration that you started with.
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!